Results 1 to 3 of 3

Thread: Loading from URL

  1. #1
    Join Date
    Aug 2004

    Loading from URL


    I am having a issue with the following code

    PHP Code:


    if( ! 
    $xml simplexml_load_file($url) ) 
    'unable to load XML file'
    'XML file loaded successfully'

    I keep getting the message "unable to load XML file" no matter how I try different approaches to make the code work.

    Anyone could give me a little help ?

    Thanks in advance

  2. #2
    Join Date
    Mar 2014
    Your url seems to be a JSON and not a XML file.

  3. #3
    The problem is that your URL that you are loading is JSON file not xml file. So to load JSON file use something like:
    $variable = file_get_contents('http://example.com/data.json');
    $decoded = json_decode($variable);

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center

Recent Articles