RE: [PHP] make use of search results from public search engines
| From: | Kurt Boyer | Date: | Mon, 14 Aug 2000 20:50:23 +0000 |
| Subject: | RE: [PHP] make use of search results from public search engines | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-11682@lists.php.net to get a copy of this message | ||
My guess is that Google is smart enough not to allow this type
of query. I would bet that the Google search script checks to
make sure that the IP address of the machine that is sending
this query matches one of their internal machines. If it isn't,
nothing is sent. This is pretty common practice.
Just my guess though...
---
Kurt A. Boyer
Advanced Software Engineer
Matchlogic, Inc.
http://www.matchlogic.com
-----Original Message-----
From: Koo [mailto:koo@sun-scope.com]
Sent: Monday, August 14, 2000 2:45 PM
To: PHP List
Subject: [PHP] make use of search results from public search engines
By specifying the following URL, you can use Google to search some
specific websites, "www.php.net" in this case, by providing certain
keywords, "zend optimizer" in this case.
http://www.google.com/search?q=zend+optimizer+site:www.php.net
Now, I'd like to buildup a search interface (a text box) for user
to do the above search and have the results displayed on MY WEBSITE.
How do I do that?
I tried the following script, but it doesn't work. :-(
<?
function PostToHost($host, $path, $referer, $data_to_send)
{
$fp = fsockopen($host,80);
fputs($fp, "GET $path HTTP/1.1\n");
fputs($fp, "Host: $host\n");
fputs($fp, "Referer: $referer\n");
fputs($fp, "Content-type: application/x-www-form-urlencoded\n");
fputs($fp, "Content-length: ".strlen($data_to_send)."\n");
fputs($fp, "Connection: close\n\n");
fputs($fp, $data_to_send);
while(!feof($fp))
{
$msg .= fgets($fp, 128);
}
return $msg;
fclose($fp);
}
PostToHost("www.google.com","/search","http://www.google.com","q=zend+optimi
zer+site:www.php.net");
echo $msg;
?>
Thanks.
Koo
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net