示例#1
0
 function rotateProxy()
 {
     global $PROXY;
     while ($PROXY['ready'] < 0) {
         proxy_api('rotate');
     }
 }
     echo "Google blocked us, we need more proxies !{$NL}";
     die;
     $newtry = 1;
 }
 if (strstr($htmdata, "http://www.download.com/Antivirus")) {
     echo "Google blocked us, we need more proxies !{$NL}";
     die;
     $newtry = 1;
 }
 if ($newtry) {
     if ($errors++ > 3) {
         echo "Abort: too many google errors! {$NL}{$NL}";
         sleep(5);
         break;
     }
     $res = proxy_api("rotate");
     $ip = "";
     if ($res <= 0) {
         echo "Error: API connection failed (Error {$res}), retry.{$NL}{$NL}{$NL}";
         sleep(10);
     } else {
         echo "API: Received proxy IP {$PROXY['external_ip']} on port {$PROXY['port']}{$NL}";
     }
     echo "Rotated IP and retrying{$NL}";
     $ch = new_curl_session($ch);
     continue;
 }
 $skip = 0;
 // now we test if (more) results are available
 if (strstr($htmdata, "/images/yellow_warning.gif")) {
     echo "No (more) results left{$NL}";
示例#3
0
function rotate_proxy()
{
    global $PROXY;
    global $ch;
    global $NL;
    $max_errors = 3;
    $success = 0;
    while ($max_errors--) {
        $res = proxy_api("rotate");
        // will fill $PROXY
        $ip = "";
        if ($res <= 0) {
            verbose("API error: Proxy API connection failed (Error {$res}). trying again soon..{$NL}{$NL}");
            sleep(21);
            // retry after a while
        } else {
            verbose("API success: Received proxy IP {$PROXY['external_ip']} on port {$PROXY['port']}{$NL}");
            $success = 1;
            break;
        }
    }
    if ($success) {
        $ch = new_curl_session($ch);
        return 1;
    } else {
        return "API rotation failed. Check license, firewall and API credentials.{$NL}";
    }
}