|
Posted by Johnny on 10/11/21 11:59
"Johnny" <removethis.huuanito@hotmail.com> wrote in message
news:a8DSg.440$UJ2.15@fed1read07...
>
> <grimrob@blackbelts.co.uk> wrote in message
> news:1159392463.579464.235310@d34g2000cwd.googlegroups.com...
> > I am looping round different URLs and reading in the contents of each
> > URL. My URLs are all valid, but for some reason I am getting an error
> > at a random point. I though maybe it could be timing out. I have used
> > $php_errormsg to try and find what the problem is, but it doesn't show
> > anything. Here's a code fragment:
> >
> > echo "$page<br>";
> > stream_set_timeout($handle, 600); // 600-second timeout
> > echo "OPEN ";
> > $handle = fopen($page, "rb") or die($php_errormsg);
> > echo "SESAME<br>";
> > $contents = stream_get_contents($handle) or die($php_errormsg);
> > fclose($handle) ;
> >
> > I just get my page followed by OPEN with no SESAME. So I know the fopen
> > is failing, but how can I find what is wrong?
> >
> One thing I notice immediaely is that you have set the timeout on $handle
> BEFORE it is set to be a stream so that line probably does zip.
> Next is that "rb" is not an option for fopen
> http://us2.php.net/manual/en/function.fopen.php but I don't think that's
the
> problem.
> When I try your code on my local server it gives the warning:
> Warning: stream_set_timeout(): supplied argument is not a valid stream
> resource in...
>
> but still echos SESAME ok
> so there's something else amiss
>
>
just to correct a mistake I made above, "rb" is just fine, don't know what I
was thinking.
Navigation:
[Reply to this message]
|