Re: problem with file_get_contents



deepeshgairola escribió:
On Jul 8, 1:54 pm, Erwin Moller
<Since_humans_read_this_I_am_spammed_too_m...@xxxxxxxxxxxxxxxx> wrote:
deepeshgairola schreef:



Hi friends ,
i am trying to read some data using file_get_contents
i am getting a warning
Warning: file_get_contents(http://72.13.81.34:8000/16931.htm)
[function.file-get-contents]: failed to open stream: Connection
refused in /home/content/t/u/b/tubtub/html/test/index.php on line 29
when i use
$data = file_get_contents('http://72.13.81.34:8000/16931.htm');
But its working well when i use $data = file_get_contents('http://
google.com');
is this because of urlhttp://72.13.81.34:8000? what shall i do to
get this function work.
thankx & regards
Hi,

I tested the same script on PHP5.2 running on XP/SP3, and it works just
fine.
It has probably to do with port 8000 somehow.

A few questions:
1) If you paste the url into a browserwindow, can you reach the site?
(On the same machine where PHP runs of course)
2) What OS are you using and which PHP version?


I am using PHP Version 5.2.8 but on a godaddy free hosting account .
> This function works fine when i run it on my localhost.
>
> And yes the web page is accessible at http://72.13.81.34:8000/16931.htm

If it's a free hosting account, it's likely that allow_url_fopen is set to off. Run phpinfo() and check its value.




This is the url on my server http://tubtub.com/test/

where i am running this script.


<?php


$data = '';

$new_string = '';

$test = '';


// Getting all the data from the report generated and getting
statistics from report //

$data = file_get_contents('http://72.13.81.34:8000/16931.htm');

echo $data;

?>




--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--
.