A
A
Aricus2019-08-27 10:24:21
PHP
Aricus, 2019-08-27 10:24:21

Why does simplexml_load_file fail when transferring a site to hosting?

$xml = 'https://module-electronic.ru'.$cssJsVersion.'&feed=smartprice';
$xmlParse = (array)(simplexml_load_file($xml)->channel);
  var_dump($xml);
  var_dump($xmlParse);

On the local server, everything is parsed well, but when uploaded to the hosting, it gives out:
string(48) " https://module-electronic.ru?v=6&feed=smartprice " array(0) { }

The validator has no complaints about the xml output on this page. A similar code with a different rss on hosting works fine.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Evgeny Matveev, 2019-09-02
@ematveev

try to download the page to a file, and then parse

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question