0

I am using HTTP API in my application. When I am calling that URL using file() method it is working fine in localhost but not in server.

I am using centos server.

In Command prompt :

#telnet www.example.com

it is getting resonse throw terminal but not in browser

Code :

<?php 
 $url = "http://www.example.com";
 $arr = file($url);
 echo '<pre>';
 print_r($arr);
 echo '</pre>';
?>
3
  • Which HTML form? Did you even read the question? Commented Dec 2, 2013 at 12:12
  • 2
    Most likely url_fopen_wrappers are not enabled. Commented Dec 2, 2013 at 12:12
  • check your server configuration by using php_info() function. Commented Dec 2, 2013 at 12:14

2 Answers 2

1

You probably have allow_url_fopen disabled on the server. Enable it to get your code to work.

Sign up to request clarification or add additional context in comments.

1 Comment

I modified in php.ini file like allow_url_include = On Thank U Every One
0

From php.net documentation:

A URL can be used as a filename with this function if the fopen wrappers have been enabled. See fopen() for more details on how to specify the filename.

And here is explanation about fopen wrappers: http://www.php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen

Check your php.ini and find allow_url_fopen option. It should be enabled to use this functionality

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.