SimpleXML - PHP

Discussion in 'PHP' started by shero4ever, Jul 20, 2008.

  1. #1
    Dear All,

    I 'm facing a problem while using SimpleXML
    new.php
    <?php
    echo "Hello1";
    $xml = simplexml_load_file("test.xml");

    echo "Hello2";
    ?>

    test.xml
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <note>
    <to>Tove</to>
    <from>Jani</from>
    <heading>Reminder</heading>
    <body>Don't forget me this weekend!</body>
    </note>

    The 2 files are in the same folder:
    the first hello message is echoed, while the second is not, as if there is a problem with the following
    $xml = simplexml_load_file("test.xml");

    I can't find a reason for this error
     
    shero4ever, Jul 20, 2008 IP
  2. blueparukia

    blueparukia Well-Known Member

    Messages:
    1,564
    Likes Received:
    71
    Best Answers:
    7
    Trophy Points:
    160
    #2
    That looks like valid code (XML and PHP) to me, so most likely it will be be something simple.

    Try replacing

    
    $xml = simplexml_load_file("test.xml");
    Code (markup):
    With

    
    $xml = simplexml_load_file('test.xml') or die('<br/>An error has occured');
    
    Code (markup):
    Run the script and copy the output into the nw reply
     
    blueparukia, Jul 20, 2008 IP
  3. shero4ever

    shero4ever Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks for your kind attention.

    well i tried this replacement

    However, I still got only the first Hello1 message.

    Even, die message is not displayed.

    Could it be a problem with the server?
    Is it for a certain php version, that my server should support it? and how do i know this.
     
    shero4ever, Jul 20, 2008 IP
  4. blueparukia

    blueparukia Well-Known Member

    Messages:
    1,564
    Likes Received:
    71
    Best Answers:
    7
    Trophy Points:
    160
    #4
    Are you sure you have simpleXML installed?
     
    blueparukia, Jul 20, 2008 IP
  5. shero4ever

    shero4ever Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    No, i guess this is the problem

    I know nothing about simpleXML installation. Can you tell me how to do this?

    Note: the server is a remote server, a yahoo one, i can only access it with filezilla.
     
    shero4ever, Jul 20, 2008 IP
  6. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #6
    Yahoo <- That's where the problem lies. What version of PHP are you running there? I've heard they only support 4. (It's pre-installed on PHP 5+)
     
    nico_swd, Jul 20, 2008 IP
  7. shero4ever

    shero4ever Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    well, let me check with the server administrator, and see what we can do.

    Thank you very much for your kind attention
     
    shero4ever, Jul 21, 2008 IP