File_get_contents() Function Is Not Working In Php
Posted On Sun Mar 11, 2012 By hostman In PHP Forums And Topics Discussions About Hyper Text Programming Language Forums
hi everyone, just wanted to share something with you today about file_get_contents().
i was trying to get some data from a url and it was not working, i was not getting anything back. this is what i found out. the url i was trying to get the information was not resolving correctly. in other words, i was running my script from a server which had the same ip address from the same server i was running the script but the domain was hosted on another server so be sure to check your hosts file to be sure the domain is not resolving somewhere it shouldnt.
for example, i wanted the output of this url:
http://www.example.com/time.php
the output was: 5:40pm
this is how the script looked like:
when i ping example.com was going to a different ip address my domain was being hosted. so i had to chang my hosts in my control panel of hosting domain names on the server i was running the script.
i was trying to get some data from a url and it was not working, i was not getting anything back. this is what i found out. the url i was trying to get the information was not resolving correctly. in other words, i was running my script from a server which had the same ip address from the same server i was running the script but the domain was hosted on another server so be sure to check your hosts file to be sure the domain is not resolving somewhere it shouldnt.
for example, i wanted the output of this url:
http://www.example.com/time.php
the output was: 5:40pm
this is how the script looked like:
<?php
$Url = 'http://www.example.com/time.php';
echo 'The time is: '.$Url;
?>
$Url = 'http://www.example.com/time.php';
echo 'The time is: '.$Url;
?>
when i ping example.com was going to a different ip address my domain was being hosted. so i had to chang my hosts in my control panel of hosting domain names on the server i was running the script.
Related Content
Information
Forums »
PHP Forums And Topics Discussions About Hyper Text Programming Language »
File_get_contents() Function Is Not Working In Php
PHP Forums And Topics Discussions About Hyper Text Programming Language »
File_get_contents() Function Is Not Working In Php
Title: File_get_contents() Function Is Not Working In Php
Description: on this page i will give you and example as to why my file_get_contents() function is not working in PHP and what i did to fix this issue
Tags: php ,dns ,error ,computer ,programming
Info: This Post Has Been Viewed 0 Times Since
Date: Sun Mar 11, 2012
Author hostman Received 0 Replies #1305
Date: Sun Mar 11, 2012
Author hostman Received 0 Replies #1305
Share
URL: 

Embed: 

To embed this topic, just copy the code from the "Embed" box. Once you've copied the code, just paste it into your website or blog to embed it
BBCODE:: 

BBCODE is use on forums. You can put this code on all your BBCODE enabled forums like PhpBB, vBulletin® and others. Just Copy and Paste this code on your Posts and Replies on your forums
wallpaperama | Wallpapers | Forums | Terms Of Service
copyright © 2013 wallpaperama - All Rights Reserved - Last Updated Mon May 06, 2013 (-8 GMT)
Powered by: Webune Forums V5
copyright © 2013 wallpaperama - All Rights Reserved - Last Updated Mon May 06, 2013 (-8 GMT)
Powered by: Webune Forums V5