RE: [PHP] Re: Getting PHP to submit a form to google
| From: | Michael Geier | Date: | Fri, 16 Aug 2002 13:41:29 +0000 |
| Subject: | RE: [PHP] Re: Getting PHP to submit a form to google | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-112957@lists.php.net to get a copy of this message | ||
a more OO approach might be to use the Snoopy PHP class
(http://snoopy.sourceforge.net)
This will allow you to do GET/POST method requests on
URLS with query variables, ie:
POST
$snoopy = new Snoopy;
$submit_vars["q"] = [ form variables ];
$submit_url = "http://www.google.com/search";
$snoopy->submit($submit_url,$submit_vars);
$result = $snoopy->results;
GET
$snoopy = new Snoopy;
$submit_url = "http://www.google.com/search?q=".[ form
variables ];
$snoopy->fetch($submit_url);
$result = $snoopy->results;
Then simply parse through $result;
> -----Original Message-----
> From: lallous [mailto:phplist@lgwm.org]
> Sent: Friday, August 16, 2002 4:24 AM
> To: php-general@lists.php.net
> Subject: [PHP] Re: Getting PHP to submit a form to google
>
>
> by simple ways, you can do that:
>
> $query = urlencode("your query string")
> $result_string = join('', file(http://www.google.com/search?q=$query));
>
>
> Elias
>
> "Henry" <henry-php-general-news@teacake.f9.co.uk> wrote in message
> news:20020815191438.10344.qmail@pb1.pair.com...
> > Hi all
> >
> > I would like to be able to get the result of a search from
> google. Namely
> I
> > would like to write a PHP script that will generate and submit a form
> > (internally i.e. on the server) using the GET method to
> > http://www.google.com/search setting the field
> > "q" to the
> search words. It
> > should then parse the results so that I can feed them back to
> the user in
> a
> > form that I choose.
> >
> > How should/can I go about this?
> >
> > TIA.
> >
> > Henry.
> >
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>