llanato
llanato

Reputation: 2503

SimpleXML Not Reading URL

I'm trying to get the below code to work. Currently it just outputs nothing, a blank page.

if($vUrlDetails = simplexml_load_file($vUrl)) {
   // Do something
}

It works fine if I use file_get_contents() and save it to a file and then use simplexml_load_file().

Are there restrictions on loading XML files over a URL using simplexml_load_file()?

Upvotes: 0

Views: 318

Answers (1)

Anyone
Anyone

Reputation: 2835

I think you can try:

<?php
  // http://www.php.net/manual/en/simplexmlelement.construct.php
  $xml = new SimpleXMLElement('http://my.url.com/something.xml', 0, true);
?>

Upvotes: 1

Related Questions