Re: fopen() for http:// sometimes working, sometimes not
| From: | Dan | Date: | Sat, 29 Dec 2007 00:15:19 +0000 |
| Subject: | Re: fopen() for http:// sometimes working, sometimes not | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-266339@lists.php.net to get a copy of this message | ||
""Albert Wiersch"" <support@htmlvalidator.com> wrote in message news:D5.5A.52211.973D3774@pb1.pair.com...
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 WierschYou 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. - Dan