Answer the question
In order to leave comments, you need to log in
Why does BaseCURL work locally but freeze on the server?
Hello. There are two functions that are responsible for checking if the proxy is alive:
public function run(){
$db = db\Proxies::find()->all();
foreach ($db as $item) {
$md=self::curl($item->ip,$item->port,'http://yoip.ru/');
if ($md['http_code']>=200&&$md['http_code']<=399){
$db= db\Proxies::find()->where(['id'=>$item->id])->one();
if(isset($db->id)){
$db->statusLive=1;
$db->save();
print_r($db->id."through http://yoip.ru/\r\n");
}
} else {
$md=self::curl($item->ip,$item->port,'https://2ip.ru/');
if ($md['http_code']>=200&&$md['http_code']<=399){
$db= db\Proxies::find()->where(['id'=>$item->id])->one();
if(isset($db->id)){
$db->statusLive=1;
$db->save();
print_r($db->id."through https://2ip.ru/\r\n");
}
}else {
$db = db\Proxies::find()->where(['id' => $item->id])->one();
if (isset($db->id)) {
$db->statusLive = 0;
$db->save();
print_r("not passed \r\n");
}
}
}
}
}
private function curl($ip,$port,$url){
BaseCURL::$proxy['ip']=$ip;
BaseCURL::$proxy['port']=$port;
return BaseCURL::makeRequest([CURLOPT_URL => $url]);
}
return BaseCURL::makeRequest([CURLOPT_URL => $url]);
Answer the question
In order to leave comments, you need to log in
Found a solution
return BaseCURL::makeRequest([CURLOPT_URL => $url,CURLOPT_POST=>false,CURLOPT_COOKIE=>false,CURLOPT_COOKIEFILE=>false]);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question