When I open the URL of XML (client 2) on browser, it opens perfectly, but when I try to open the same URL (copied and pasted in full) with simplexml_load_file in PHP I got the errors, including 404 (NOT FOUND). Does anyone have any solution?
Note: I changed the customers's addresses (URL) and the path of the PHP file to '/path/arquivo.php'.
<?php
$customers[1] = 'http://www.customer1.com.br/dados.xml';
$customers[2] = 'http://www.customer2.com.br/dados.xml';
$xml1 = simplexml_load_file ($customers[1]); // it works perfectly
$xml2 = simplexml_load_file ($customers[2]); // ERROR
Errors that I got
Warning: file_get_contents (http://www.cliente2.com.br/dados.xml): failed to open stream: HTTP request failed! HTTP / 1.1 404 Not Found in /path/arquivo.php on line 5
Warning: simplexml_load_file (): I / O warning: failed to load external entity "http://www.cliente2.com.br/dados.xml" in /path/arquivo.php on line 5
I've tried using libxml_disable_entity_loader (false); before opening the file but the error remains.
I'm using Ubuntu 14.04.3 LTS, with PHP 5.5.9.
I'll appreciate any help!
Thanks a lot!
simplexml_load_file? Can you access the url from a terminal via curl? ex.$> curl http://problem.url.com/dados.xml?