Jump to content

Recommended Posts

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!
Link to comment
https://forums.phpfreaks.com/topic/11272-problem-with-fopen-timing-out/
Share on other sites

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]
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.