Page 1 of 1

This code doesn't seem to work

Posted: Sat Sep 29, 2007 5:29 pm
by legend986
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); 
?>

Posted: Sat Sep 29, 2007 5:42 pm
by jeffery
something wrong with your pattern matching. Better place to ask is in the Regex forums: viewforum.php?f=38

Posted: Sat Sep 29, 2007 5:43 pm
by legend986
Ok Solved it myself... I should've enabled the Return transfer