[PHP] Re: fopen() for http:// sometimes working, sometimes not

2007-12-29 Thread Albert Wiersch

Dan [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

 You really need to filter your input more, have a list of what is 
 acceptable not what is unacceptable.  That being, make it a requirement 
 that the url input has a TDL(.com, .net, .org, etc.) or is a valid IP(ping 
 it), only allow alphanumerics for the name, etc.  When you don't validate 
 your site can get hacked, I know it's not really insecure but it's just an 
 example of input you may not expect, if you try to validate 
 http://localhost it goes ahead and validates your server's html.

I make sure it starts with http: or https: and change spaces to %20 so 
it will work. I also check for some possible recursion issues. I think I'm 
fairly secure just doing that. What could happen security wise? What else do 
you think I need to do? I don't want to check for a TLD as there are many 
and I don't think it is necessary... and pinging doesn't seem like a good 
idea either as some servers probably won't respond to pings.

The localhost issue is interesting, but I don't see it as a security issue.

I would like to know if there are any serious secirity issues I may be 
overlooking though.

Thanks,
Albert

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: fopen() for http:// sometimes working, sometimes not

2007-12-28 Thread Albert Wiersch
I'm now using PHP 5.2.5.

Well, it seems to still be happening. This describes the problem but I 
haven't found a solution that works for me yet:
http://bugs.php.net/bug.php?id=11058

Is it a PHP problem or DNS? It works sometimes but not other times.. 
something strange is going on.

Example messages:
[Fri Dec 28 11:59:04 2007] [error] [client 192.168.0.51] PHP Warning: 
fopen() [a href='function.fopen'function.fopen/a]: 
php_network_getaddresses: getaddrinfo failed: Name or service not known
[Fri Dec 28 11:59:04 2007] [error] [client 192.168.0.51] PHP Warning: 
fopen(http://www.lantanalinks.com) [a 
href='function.fopen'function.fopen/a]: failed to open stream: Success

I suppose I could adjust the script to try again if it fails the first time, 
but I shouldn't have to.

Some additional info, when it fails with this problem, it fails very quickly 
(in less than half a second)... its like it doesn't even try to look up the 
name.

-- 
Albert Wiersch
Fix your website: http://onlinewebcheck.com


Albert Wiersch [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

 I noticed my script at http://onlinewebcheck.com was sometimes (fairly 
 often) failing to open some URLs that users have entered. fopen() returns 
 false very quickly, but when tried again with the same URL, sometimes it 
 works. What would cause this behavior? Why does fopen() occasionally fail 
 to open valid http addresses but works at other times?

 -- 
 Albert Wiersch 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: fopen() for http:// sometimes working, sometimes not

2007-12-28 Thread Albert Wiersch

Wolf [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 DNS issues

I think I've solved this. I found a problem with resolv.conf that contained 
some outdated DNS servers. After changing that and rebooting the server it 
seems to be working. It didn't seem to work after just changing the file and 
restarting apache though, it seems like the reboot was necessary. I don't 
know why but so far do good.

The root.hints file was also updated. I'm not sure if that had anything to 
do with it but it was updated in the process of trying to fix the problem.

Albert 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] fopen() for http:// sometimes working, sometimes not

2007-12-27 Thread Albert Wiersch

I noticed my script at http://onlinewebcheck.com was sometimes (fairly 
often) failing to open some URLs that users have entered. fopen() returns 
false very quickly, but when tried again with the same URL, sometimes it 
works. What would cause this behavior? Why does fopen() occasionally fail to 
open valid http addresses but works at other times?

-- 
Albert Wiersch

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] fopen() for http:// sometimes working, sometimes not

2007-12-27 Thread Albert Wiersch

Daniel Brown [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 On Dec 27, 2007 11:31 AM, Albert Wiersch [EMAIL PROTECTED] 
 wrote:

Are the URLs being passed to fopen() properly escaped?  Are they
 valid, complete with http:// placed before the domain?  Try keeping a
 log of all URLs entered for a bit, and see which ones fail.

It's not the URL because the same URL will not work one time but will work 
another time.

What needs to be escaped for a URL anyway? I am just changing spaces to 
'%20' now.

I will try upgrading to 5.2.5. I'm using 5.2.3 now.

Thanks,
Albert

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: fopen() for http:// sometimes working, sometimes not

2007-12-27 Thread Albert Wiersch

Some additional info. It seems I am getting these warnings when it fails:

Warning: fopen() [function.fopen]: php_network_getaddresses: getaddrinfo 
failed: Name or service not known

Warning: fopen(http://wanganda2u.co.uk) [function.fopen]: failed to open 
stream:

Now I have to find out why that is failing some of the time but not other 
times.

-- 
Albert Wiersch
Fix your website: http://onlinewebcheck.com


Albert Wiersch [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

 I noticed my script at http://onlinewebcheck.com was sometimes (fairly 
 often) failing to open some URLs that users have entered. fopen() returns 
 false very quickly, but when tried again with the same URL, sometimes it 
 works. What would cause this behavior? Why does fopen() occasionally fail 
 to open valid http addresses but works at other times?

 -- 
 Albert Wiersch 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: fopen() for http:// sometimes working, sometimes not

2007-12-27 Thread Albert Wiersch

Daniel Brown [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

That sounds like a DNS resolution error.  If you have Telnet/SSH
 or local console access, try doing a dig, traceroute, and ping series
 on it.

Hi Daniel,

Yes, I have SSH access. I will keep that in mind. Upgrading to 5.2.5 may 
have addressed this issue though. If not, then I'll concentrate on a 
possible DNS resolution problem.

Albert

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: fopen() for http:// sometimes working, sometimes not

2007-12-27 Thread Albert Wiersch

Albert Wiersch [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

 Yes, I have SSH access. I will keep that in mind. Upgrading to 5.2.5 may 
 have addressed this issue though. If not, then I'll concentrate on a 
 possible DNS resolution problem.

Well, it seems to still be happening. This describes the problem but I 
haven't found a solution that works for me yet:
http://bugs.php.net/bug.php?id=11058

Is it a PHP problem or DNS? It works sometimes but not other times.. 
something strange is going on.

Albert

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php