Jump to content


Photo

Problem with fopen() timing out


  • Please log in to reply
1 reply to this topic

#1 snidog

snidog
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 05 June 2006 - 09:26 PM

I am attempting to use fopen() to open an external URL (one of our other servers). I can open the URL fine in a browser, and it returns 625K of XML data. When I try to use fopen() to grab that data, I get the following error:

Warning: fopen(http://255.255.255.255/fileName.asp) [function.fopen]: failed to open stream: Connection timed out in /var/www/server/file.php on line X

I use fopen() on the same server to open a different external URL and it worked fine. I also tested on a different external URL that was IP-based, and it worked fine. I have verified that allow_url_fopen is enabled (obviously, since the other tests worked fine). The only thing I can think of is that fopen is choking on the amount of data -- perhaps 625K of XML data is too much for it.

Does anyone know a way around this? Thanks in advance!

#2 Buyocat

Buyocat
  • Members
  • PipPipPip
  • Advanced Member
  • 267 posts

Posted 05 June 2006 - 09:39 PM

Well I don't know if this will solve the problem but you should specify how you want to handle the file you're opening. So:
fopen ($file); // should really be:
fopen ($file, "r"); // r for read

you can see what other letters work here:
[a href=\"http://us2.php.net/fopen\" target=\"_blank\"]http://us2.php.net/fopen[/a]

Looking for some easy-to-use tools?  Try these, https://sourceforge....jects/utils-php -- I made them myself.  They're distinct tools which are easy to understand and use.  See some examples uses at http://www.anotherearlymorning.com




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users