sandrodz Posted May 19, 2011 Share Posted May 19, 2011 Hello, stristr('http://www.google.com/', 'google') doesn't work but stristr('http://localhost/test.html', 'sandro') works why is this? and how can I solve this problem? Link to comment https://forums.phpfreaks.com/topic/236833-stristr-dosnt-get-external-sites-as-string-for-me-s/ Share on other sites More sharing options...
anupamsaha Posted May 19, 2011 Share Posted May 19, 2011 It works for me. What you want to do? Link to comment https://forums.phpfreaks.com/topic/236833-stristr-dosnt-get-external-sites-as-string-for-me-s/#findComment-1217476 Share on other sites More sharing options...
sandrodz Posted May 19, 2011 Author Share Posted May 19, 2011 I'm running it on localhost. that is lamp. I get this error: [error] [client 127.0.0.1] PHP Warning: file_get_contents(http://www.web-source.net/html_codes_chart.htm): failed to open stream: Connection timed out in /var/www/track.php on line 14, referer: http://localhost/ Link to comment https://forums.phpfreaks.com/topic/236833-stristr-dosnt-get-external-sites-as-string-for-me-s/#findComment-1217514 Share on other sites More sharing options...
anupamsaha Posted May 19, 2011 Share Posted May 19, 2011 So, is the issue with "stristr" or with "file_get_contents"? The error that you are seeing that is due to a setting of allow_fopen_url is turned off in you php.ini file and that is good for security reason. Still, if you want to open an remote URL through PHP, use cURL instead. Link to comment https://forums.phpfreaks.com/topic/236833-stristr-dosnt-get-external-sites-as-string-for-me-s/#findComment-1217516 Share on other sites More sharing options...
sandrodz Posted May 19, 2011 Author Share Posted May 19, 2011 yes! you are absolutely right... I use file_get_contents on local machine and it fails. But I looked in php.ini and I have: allow_url_fopen On On :S any ideas? Link to comment https://forums.phpfreaks.com/topic/236833-stristr-dosnt-get-external-sites-as-string-for-me-s/#findComment-1217545 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.