Results 1 to 2 of 2

Thread: Problem Retrieving XML Data

  1. #1
    Join Date
    Mar 2005
    Behind you...

    Problem Retrieving XML Data

    I can't really seem to read my XML file and get the data. Or, really, I can't seem to read the data and put it in a var.

    Below is my php file, and below that is my xml file.

    PHP Code:

    $redirvars "user=Foo&id=Foo";
    $holdsendurl .= "http://www.foo.com/welcome.html?" "{$redirvars}";

    $default_dir "loggedusers.xml";

    $xmlstr simplexml_load_file($default_dir);


    $dom = new domDocument;


    $s_dom simplexml_import_dom($dom);

    $usrstr "";

    $s_dom->loggeduser[0]->username as $gname

    $usrstr .= "<username>" "{$gname}"</username>";

    $usrstr .= "<username>" "{$name}"</username>";

    $xmlstr "<?xml version='1.0' encoding='UTF-8' ?><loggeduser>" "{$usrstr}"</loggeduser>";

    $dom2 = new domDocument;


    $test $dom2->save("loggedusers.xml");

    "<br>hello World!<br><br><textarea>".$usrstr."</textarea>";

    PHP Code:
    <?xml version="1.0" encoding="UTF-8"?>
    Whenever the php runs, it will simply save this exact file, but it should add a 'Foo' user to the list. Or at least that is what I want it to do.

    It seems that it does not read the 'username' and get the list of users, then save them to the variable for me to save again.

    any ideas?

  2. #2
    Join Date
    Mar 2005
    Behind you...
    ....I didn't think this was complicated or anything, I'm just new with PHP.

    Does anyone know how to properly read XML with PHP?

Thread Information

Users Browsing this Thread

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

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