Error reading XML file

0

Well, every time I push to read an XML file in my localhost to return some XML response, everything works out fine, but when I host that page, it gives error. What can it be?

The error that appears is this:

  

Warning: simplexml_load_file ( link )   [function.simplexml-load-file]: failed to open stream: Connection   timed out in /home/plusr582/public_html/tocando.php on line 2

     

Warning: simplexml_load_file () [function.simplexml-load-file]: I / O   warning: failed to load external entity   " link " in   /home/plusr582/public_html/tocando.php on line 2

    
asked by anonymous 10.08.2016 / 00:30

2 answers

2

It does not seem to be blocking, copy this code below

$url = 'http://painel.foxsolucoes.net/api/VFZSTmVrMTZaejA9KzU=';
$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, $url );
curl_setopt( $ch, CURLOPT_POST, true );
curl_setopt( $ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml'));
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt( $ch, CURLOPT_POSTFIELDS, "<xml>here</xml>" );
$result = curl_exec($ch);
curl_close($ch);

$xml = simplexml_load_string($result);
$xml_arr_Content = unserialize(serialize(json_decode(json_encode((array)$xml),1)));

echo '<pre>';
var_dump($xml_arr_Content);exit;

If it does not work, check that there is no missing php extension on your machine.

    
10.08.2016 / 04:07
0

The link is accessible and loads normally.

Your server's IP may be blocked.

There's nothing to do in this case, other than to contact the site administration.

    
10.08.2016 / 00:50