You are here: Re: fread usage « PHP Programming Language « IT news, forums, messages
Re: fread usage

Posted by Jerry Stuckle on 05/04/06 15:53

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

OK, Vito, what happens when you try this?

One thing I see as a possible problem - you're reading up to 9MB. Do you have
that much memory available to PHP? You might have run out. Check your error logs.

BTW - do you have Google's permission? Last I heard they didn't like people
doing this.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация