Re: fread usage



vito wrote:
after reading your comments,

i made some changes.

1)switch to use "acd" instead of "big problem"
2)try use file_get_contents instead


$theFile ="http://images.google.com/images?q=acd";;


the $content contains:

<img src=/images?q=tbn:8w7TF3ADocTy3M:cheminf.cmbi.ru.nl/cheminf/isis/pict/acd_price.gif width=134 height=105>

but i just don't know why

$matchno = preg_match_all("/.*<img src=/images?q=tbn:.*:(.*) width=.*>.*/", $content, $regs);

returns nothing. ($matchno echo nothing)

furthermore, how is Jerry able to count the size? could anybody tell me? indeed, i need not retrieve the whole content but just a single little image is grateful.




Vito,

I was looking at your fread() call - you say get up to 9*1024*1024 bytes - which is 9 mb.

And you are getting the correct information back. When you fetch a page containing images, the webserver returns <img> tags. The browser must then go out and fetch each of those images.

Open the page with your query and then look at the HTML source. This is what your program should be getting. Writing that to the user's browser should cause the browser to initiate further connections to retrieve the data.

As for your regex - ? is a control character (makes the preceding character optional). You need to escape it, i.e.

... images\?q=tbn ...

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