You are here: Re: $php_errormsg is blank after fopen « All PHP « IT news, forums, messages
Re: $php_errormsg is blank after fopen

Posted by Johnny on 10/11/04 11:59

<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

 

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

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