Проверка работоспособности прокси

Код


function checkProxy($proxy){
    //$proxyauth = 'user:password';  
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, 'http://dynupdate.no-ip.com/ip.php');
    curl_setopt($ch, CURLOPT_PROXY, $proxy);
    //curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxyauth);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_TIMEOUT, 120);   
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_HEADER, 1);
    $curl_scraped_page = curl_exec($ch);
    curl_close($ch);
    $status = explode("\n", $curl_scraped_page);
    if(preg_match('/200/i', $status[0])){
        return true;
    }
    else {
        return false;
    }
}

Пример