Re: Strange results from file_get_contents using an url as filename

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ewout de Boer wrote:

I'm getting unexpected data from my file_get_contents function using an url
as filename.

The function does not return false, i do get data from it. Problem is that
is is not the data is requested.


$data = file_get_contents("http://somehost.com/xmlonl.asp?custid=000000&prodid=00000 ");

 if ($data)
 {
   ...


the string this function returns is the webpage from the default website of the server where this php code is running at and not the data from the remote site (which is not on the same server).

i tried the url from my shell on the server using telnet and it gets the
data i expected.

I can't figure out why php is getting the wrong results while telnet on the
same host gets the correct data. Is this a (known) error with php or is it a
apache/php/server configuration problem ?


regards, Ewout

*Check your PHP runtime config to see if 'allow_url_fopen' is enabled. (You can view your configuration using 'phpinfo'. You can change it in your php.ini file.)

(See the first tip in the fine manual: http://us4.php.net/manual/en/function.file-get-contents.php )
**
-John
*


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux