cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

Re: Using Curl to search google?

From: Ken Harris <kharris_at_lhinfo.com>
Date: Thu, 9 Oct 2003 18:11:01 -0400

Haven't actually tried to use it as a search, but a "manual" google search
results in a command line that looks like this, "http://www.google.com/search?
hl=en&ie=UTF-8&oe=UTF-8&q=eastern+bluebird". Opening a browser and typing
this: "http://www.google.com/search?q=eastern+bluebird" also yields the search.

So, you would need to change the URL. And change the "f=<search>"
to "q=<search>".

That should work.

Ken

Quoting ErAzeR <erazer.se_at_telia.com>:

> 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 mail sent through IMP: http://horde.org/imp/

-------------------------------------------------------
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