To ping pingomatic, I should just surf the get url
echo file_get_contents("http://example.com/ping/?title=blah+blah+blah");
works fine. However when I tried to use curl, it doesn't work.
What should I do? What did I do wrong?
<?
//require_once ("../tools.php");
//The code below works perfectly. Now try to do the equivalent with curl
//echo file_get_contents("http://example.com/ping/?title=blah+blah+blah");
$ch = curl_init();
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_URL, "http://example.com/ping/?title=blah+blah+blah" );
//curl_setopt ($ch, CURLOPT_URL, "http://wikipedia.com" ); // This code works fine if I tried to load [url]http://wikipedia.com[/url] instead.
//curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/1.6");
curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0");
curl_setopt ($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt ($ch, CURLOPT_TIMEOUT, 5);
//curl_setopt ($ch, CURLOPT_INTERFACE, $ipUsed);
//curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, TRUE ); // Doesn't work when safemode is on
curl_setopt ($ch, CURLOPT_HEADER, TRUE);
echo curl_exec ($ch );
//to show you that I know how to use curl let's try to get google.com
//echo curl_exec ($ch);
?>