PDA

View Full Version : Php: Fopen Fails Randomly When Open Webpages


Gabe Brown
01-10-2005, 11:37 PM
Question. I've made a custom app called a keyword extractor that loads a webpage and parses the HTML to determine the contents of the page. The problem is that two pages are effected by trying to perform an fopen that used to work last week. Now i'm getting random failures and I have no clue other than to think the server is going crazy.


<code>

// Open the url
$fp = @fopen ($url, "r");
$content = "";

if(!$fp) {
Toss an error
}

</code>

I've got two scripts effected by this!! Admins, any ideas?

See for youself at http://www.gabosgab.com/keyExt/index.php

Try it a few times and you'll see if fail probably..

edmicman
01-11-2005, 12:59 AM
is fopen related to fsockopen at all? My script (IlohaMail) just recently started getting some weird errors, too. I'm still trying to figure out if its my install, or if theres something funky with PHP or IMAP....heres a bump for ya...

gabosgab
01-11-2005, 01:45 PM
Originally posted by edmicman@Jan 10 2005, 11:59 PM
is fopen related to fsockopen at all? My script (IlohaMail) just recently started getting some weird errors, too. I'm still trying to figure out if its my install, or if theres something funky with PHP or IMAP....heres a bump for ya...
Quoted post


I believe that it will invoke fsockopen if it determines it to be a remote address. (IE a webpage instead of a local file.) I've used this countless times on this server for the last 3 months with no problem and now it's breaking. WTF... The only error I'm getting is that it cannot open the target website, which is know to be working.

skidawg
01-11-2005, 04:29 PM
I am just guessing here, but I was wondering if the updates to php/wget/curl/whatever else that were done to protect the server from the Santy virus a few weeks ago would have anything to do with this.

curl was updated December 26th.
php was updated December 21st.
not sure about the wget issues, seach the forums for more info.

I have no idea if this helps at all, but I thought it was at least worth mentioning.

eugene
01-12-2005, 10:05 AM
If it is failing on one particular website, consider the possibility that the website is rejecting your UserAgent.

edmicman
01-12-2005, 11:14 AM
For what its worth, my problem seems to have disappeared in the last day or so. I'm not aware of any change that occurred, either, so who knows....