Google Suche
Dieses Script liest die ersten 10 Funde von Google ein und
gibt sie dann aus
|
Script: |
<?php
error_reporting(E_ALL);
if(!isset($q))
{
echo "<form
action=\"".$_SERVER["PHP_SELF"]."\"
method=\"post\">
<input
type=\"text\" name=\"q\">
<input
type=\"submit\" value=\"search\">
</form>";
}
else {
$off_site
= "http://www.google.com/search?q=".urlencode($q)."&ie=UTF-8&oe=UTF-8";
$fp
= fopen ($off_site,
"r")
or die("Unable to open file ".$off_site."
for reading");
while (!feof
($fp))
{
$buf
= trim(fgets($fp,
4096));
$pos
= strpos($buf,"<p
class=g>");
if($pos
!== false)
{
$parts
= explode("<p
class=g>", $buf);
$parts2
= explode("http://",
$parts[1]);
$parts3
= explode(">",
$parts2[1]);
echo
"<a href=\"http://".$parts3[0]."\"
target=\"_blank\">".$parts3[0]."</a><br>";
}
}
}
?>
|
|