This code doesn't seem to work
Posted: Sat Sep 29, 2007 5:29 pm
I'm trying to retrieve the contents from a website but it keeps displaying "array()" and the page but it doesn't display the $req_info value. What mistake am I doing?
Code: Select all
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"http://asn.cymru.com/cgi-bin/whois.cgi");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,
"action=do_whois&family=ipv4&method_whois=whois&bulk_paste=72.14.253.99&submit_paste=Submit");
$result = curl_exec ($ch);
//echo $result;
$pattern = "/[1-9]{1,9}\s\s\s[|]\s[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/";
$req_info = array();
preg_match($pattern,$result,$req_info);
print_r($req_info);
curl_close ($ch);
?>