M.O.S. Studios Posted May 6, 2009 Share Posted May 6, 2009 this is the code i use to check if a user entered url is valid. function test_httpurl($url) { $resaults = (($fp = @fopen($url, 'r')) === false) ? false : @fclose($fp); if($resaults==FALSE) { return $url.BADURL; } } I use it on my personal server (it has php 5) and it works fine. however I'm trying to use it on another server that only has php 4.xx. MY problem is on the new server every thing is returned as false. Does any one know why?? I'm thinking it might be either a php.ini setting or a limitation of php 4. I looked up fopen() and it should work fine on php 4, so im fairly sure its a php.ini setting. do u guys have any ideas? Link to comment https://forums.phpfreaks.com/topic/157123-solved-url-check-not-working/ Share on other sites More sharing options...
Zhadus Posted May 6, 2009 Share Posted May 6, 2009 Remove the @'s and see if there are any errors. Link to comment https://forums.phpfreaks.com/topic/157123-solved-url-check-not-working/#findComment-827832 Share on other sites More sharing options...
premiso Posted May 6, 2009 Share Posted May 6, 2009 Chances are, if you have a shared host, allow_url_fopen_wrappers (unsure of the exact name but close enough) is disallowed for security reasons. You should look into converting it to cURL if your host allows cURL. Link to comment https://forums.phpfreaks.com/topic/157123-solved-url-check-not-working/#findComment-827833 Share on other sites More sharing options...
M.O.S. Studios Posted May 6, 2009 Author Share Posted May 6, 2009 awesome, i wrote this line in my php.ini allow_url_fopen=on and it now works thanks guys Link to comment https://forums.phpfreaks.com/topic/157123-solved-url-check-not-working/#findComment-827874 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.