Page 1 of 1

Proxy Checker Script

Posted: Wed Dec 16, 2009 11:22 am
by NikeUs
What am I doing wrong? So far I've not had any luck in getting this to work.

Code: Select all

<?php
 
$testpage = "http://www.google.com";
 
$GOODP = array();
$proxylist = $_POST['proxlist'];
 
if (isset($proxylist)) {
    $proxtext = explode("\n", $proxylist);
    foreach ($proxtext as $proxy) {
        $ch = curl_init($testpage);
        // sets the proxy to go through
        curl_setopt($ch,CURLOPT_PROXY,$proxy);
        // sets to use a tunnel proxy which most http proxies are
        curl_setopt($ch,CURLOPT_HTTPPROXYTUNNEL,$proxy);
        // makes the curl call do it's work based on what we've set previously and
        //returns that fetched page to $page
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        $page = curl_exec($ch);
        // cleans up the curl set   
        curl_close($ch);
        // this will check that there was some html returned, now some sites might block some
        //proxies so you'd want to set for that specific site in the $testpage var and then
        //find something on that page to look for with the below function.
        $check = stripos($page,'</html>');
        // if there was a match in the stripos (string postion) function echo that the
        //proxy got the data and works
            if($check > 0)
            {
                echo $proxy." Works!";
                // or else echo it doesn't work
            }else{
                echo $proxy." Is Dead!";
            }
    }
}
 
 
 
 
?>
 
<form name=proxform method=post action="?">
 
<table>
    <tr><td>PROXIES:<br>
        <textarea rows=10 cols=40 name=proxlist></textarea>
    </td></tr>
    <tr><td><input type=submit></td></tr>
    
</table>
 
</form>