My server contain a file at http://XX.XX.XX.XX:7550/check.txt
and in which only Online
is written. Now I am on my shared hosting and I want to get Online
in my shared hosting php file for that I am using the below code in my shared hosting php file.
<?php
var_export(ini_get('allow_url_fopen'));
$uri = 'http://XX.XX.XX.XX:7550/check.txt';
$result = file_get_contents($uri);
echo $result;
?>
But I am only getting '1'
instead of '1' Online
. So can you answer my why not working when I enter my server IP?
Note: And when I am adding http://www.google.com
instead of http://XX.XX.XX.XX:7550/check.txt
then I am getting whole Google page.
Important Note: I am able to open http://XX.XX.XX.XX:7550/check.txt
in my web-browser directly via proxy means no firewall blocking is in my server (Ubuntu Server 14.04 LTS).
UPDATE:
I also tried CURL
and that's also not working with http://XX.XX.XX.XX:7550/check.txt
but working with http://www.google.com
.
<?php
function curl_load($url){
curl_setopt($ch=curl_init(), CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
curl_close($ch);
return $response;
}
$url = "http://XX.XX.XX.XX:7550/check.txt";
echo curl_load($url);
?>