Пример: http://www.whois.net/whois/hotmail.com
При открытии в браузере отображается вывод.
При использовании вызова curl ничего не отображается.
Что не так? Я хочу вернуть весь результат страницы, а затем использовать регулярное выражение для извлечения данных со сроком действия: 29 марта 2015 г., 00:00:00.
$postfields= null;
$postfields["noneed"] = "";
$queryurl= "http://www.whois.net/whois/hotmail.com";
$results= getUrlContent($postfields, $queryurl);
echo $results;
function getUrlContent($postfields,$api_url)
{
if( !extension_loaded('curl') ){die('You need to load/activate the cURL extension (http://www.php.net/cURL).'); }
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $api_url); // set the url to fetch
curl_setopt($ch, CURLOPT_HEADER, 0); // set headers (0 = no headers in result)
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // type of transfer (1 = to string)
curl_setopt($ch, CURLOPT_TIMEOUT, 10); // time to wait in seconds
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
$content = curl_exec($ch); // make the call
curl_close($ch);
return $content;
}