0
我有一個返回服務器響應的代碼,但它使用的是fscokopen
函數,該函數在我用於此項目的服務器上不可用。將fsockopen重寫爲捲曲
如何將其重寫爲CURL或類似的替代?
$server = 'whois.afilias.net';
$fp = @fsockopen($server, 43,$errno, $errstr, $this->m_connectiontimeout);
if($fp){
@fputs($fp, $domain."\r\n");
@socket_set_timeout($fp, $this->m_sockettimeout);
while([email protected]($fp)){
$data .= @fread($fp, 4096);
}
@fclose($fp);
return $data;
}else{
return "\nError - could not open a connection to $server\n\n";
}