PixelArtie
PixelArtie

Reputation: 31

Read html data from given url

I have the below code that tries to pull text from an url.

include_once("html_parser/simple_html_dom.php");
$html=file_get_html("http://82.77.18.164:8080/Iphone/get_puncte.php");

print_r($html);

echo file_get_contents("http://82.77.18.164:8080/Iphone/get_puncte.php");

echo stream_get_contents(fopen('http://82.77.18.164:8080/Iphone/get_puncte.php', "r")); 

If i access the url in my browser it works fine, but in when i access the php file with the code above i receive the below erros.

PHP Warning:  file_get_contents(http://82.77.18.164:8080/Iphone/get_puncte.php): failed to open stream: Connection refused

PHP Warning: stream_get_contents() expects parameter 1 to be resource, boolean given in /home/xxxxx/public_html/test.php on line 9

Any idea ?

Upvotes: 0

Views: 63

Answers (1)

RagZ
RagZ

Reputation: 319

Some servers deny using an IP address instead would recommend to use curl

Upvotes: 2

Related Questions