Jump to content

file_get_contents


Craig Hopson

Recommended Posts

OK so i have this snipit of code and it's making me look like a fool

<?php$url="All other trademarks and material are the prop of their respectful owners";$site = file_get_contents("https://www.footle.net");if (strpos($site,$url) !== false) {   echo 'GOOD'; } else {   echo 'BAD';}?>

Works fine on my server but my clients server gives this error

Warning: file_get_contents(https://www.footle.net) [function.file-get-contents]: failed to open stream: No such file or directory in /usr/local/apache2/htdocs/test-1.php on line 3BAD
PLEASE help me work round this
Link to comment
Share on other sites

It sounds like their server does not support the URL wrappers for fopen, it is looking for a local file instead of a URL. There are other ways to get that content (e.g., using the cURL library), but if one is disabled they might have all of those functions disabled for everyone.

Link to comment
Share on other sites

could have something to do with https, maybehttp://stackoverflow...ents-with-https if not, JSG already suggested cURL as an alternative

Edited by thescientist
Link to comment
Share on other sites

fopen and file_get_contents() uses same wrappers. so if it is not working with one, will not work with either for same reason.

Link to comment
Share on other sites

that boils down to the solution thescintist said. you can still use http:// without secure conection to get conetnts of the file.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...