curl-and-php
Using Curl to search google?
Date: Fri, 10 Oct 2003 00:05:20 +0200
Hi, I want use curl to search google. That can't be that tough? I have tried to like this
<?
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"http://www.google.com/");
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // return into a variable
curl_setopt($ch, CURLOPT_TIMEOUT, 3); // times out after 4s
curl_setopt($ch, CURLOPT_POST, 1); // set POST method
curl_setopt($ch, CURLOPT_POSTFIELDS, "f=mysearchstring");
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 0);
$result =curl_exec ($ch);
curl_close ($ch);
echo $result;
?>
But it doesnt work.
All suggestions or help, are appreciated.
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
SourceForge.net hosts over 70,000 Open Source Projects.
See the people who have HELPED US provide better services:
Click here: http://sourceforge.net/supporters.php
Received on 2003-10-10