chevron_left chevron_right
Login Register invert_colors photo_library
The Discord has been disabled - read about it here, check out our IRC here, and if you're upgraded check here.
Thread Rating:
  • 0 Vote(s) - 0 Average


filter_list sunjester's proxy checker
Author
Message
sunjester's proxy checker #1
[Image: 8He3mTd.png]

So it's pretty basic. If you make changes or have suggestions, leave a message on the thread. The checker will tell you if it is online and what type of proxy it is.

supported types:
  • socks4
  • socks4a
  • socks5
  • http
  • https
  • http 1.0

Code:
<h3>sunjester&apos;s proxy checker</h3>
<p>This checker requires your proxies to be in the format of IP:PORT</p>
<p>This checker will determine if a proxy is online and what type of proxy it is.</p>

<form method="post">
        <p><textarea name="proxies" cols="80" rows="20" placeholder="paste your proxies here"></textarea></p>
        <p>
        <b>Output</b><br/>
        <!--input type="radio" name="output" id="json_out" value="json" /> <label for="json_out">JSON output</label-->
        <input type="radio" name="output" id="raw_out" value="raw" checked /><label for="raw_out">Raw</label>
        </p>
        <p><button type="submit">Check proxies</button></p>
</form>

<?php

if($_POST)
{
        $checker = new SJProxyChecker($_POST['proxies']);
        echo $checker->check();
}

class SJProxyChecker
{
        private $ip;
        private $port;
        private $proxies;
        private $proxy_types = [
                "CURLPROXY_SOCKS5",
                "CURLPROXY_HTTP",
                "CURLPROXY_HTTPS",
                "CURLPROXY_HTTP_1_0",
                "CURLPROXY_SOCKS4",
                "CURLPROXY_SOCKS4A"
        ];
        private $result = "<table border=1>";

        function __construct($proxylist)
        {
                $this->proxies = explode("\n", $proxylist);
        }

        function check()
        {
                foreach($this->proxies as $proxy)
                {
                        foreach($this->proxy_types as $type)
                        {
                                $proxy_info = explode(":", $proxy);
                                if($this->isOnline($proxy_info[0], $proxy_info[1]))
                                {
                                        $r = $this->makeReq($proxy, $type);

                                        if($r == $proxy_info[0])
                                        {
                                                $this->result .= "<tr><td>".$proxy."</td><td>".$type."</td></tr>";
                                                break;
                                        }
                                }
                        }
                }

                $this->result .= "</table>";
                return $this->result;
        }

        function isOnline($ip, $port)
        {
                if(fsockopen($ip, $port, $errno, $errstr, 30))
                {
                        return true;
                } else {
                        return false;
                }
        }

        function makeReq($proxy, $type)
        {
                $ch = curl_init();

                curl_setopt($ch, CURLOPT_URL, "https://api.ipify.org");
                curl_setopt($ch, CURLOPT_PROXY, $proxy);
                curl_setopt($ch, CURLOPT_PROXYTYPE, $type);
                curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
                curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

                $result = curl_exec($ch);
                curl_close($ch);
                return $result;
        }
}
?>
(This post was last modified: 01-10-2019, 04:04 PM by sunjester. Edit Reason: grammar. )

Reply






Users browsing this thread: 1 Guest(s)