|
Posted by Schraalhans Keukenmeester on 05/04/06 15:22
vito wrote:
> a week ago 2 kind persons suggested me to use fread to read a result page.
> i've been working for it but just can't get what i want.
>
>
> $keyword ="big problem";
> $startfig = rand(0,60);
> //$theFile
> ="http://images.google.com/images?q=\"".$keyword."\"&start=".$startfig;
> //$theFile
> ="http://images.google.com/images?q=\"".$keyword."\"&start=".strval($startfig);
> $theFile ="http://images.google.com/images?q=acd";
>
> if (($f = fopen($theFile, 'r')) === false) exit;
>
> $contents = fread($f, (9*(1024*1024)));
>
> echo "$contents";
> fclose ($f);
>
> $matchno = preg_match_all("/.*<img src=/images?q=tbn:.*:(.*)
> width=.*>.*/", $contents, $regs);
> $imgurl = $regs[rand(0,$matchno-1)];
>
> why can't i retrieve the result obtained from google image search?
>
>
The url you feed to google does NOT bring me any results at all, instead
I get this error:
"The requested URL /?q=%22big%20problem%22&start=30 was not found on
this server."
Looks like google likes another syntax. "big problem" fed to the image
search page on my google yields the following url:
http://images.google.nl/images?svnum=10&hl=nl&lr=&q=%22big+problem%22&btnG=Zoeken
Of course your result will be slightly different, you don't get the
Dutch google I assume. The quotes are never used AFAIK in google.
Maybe your problem lies here, not in the fread you use.
Sh.
--
Our POP server was kidnapped by a weasel.
[Back to original message]
|