xmldom php 4

Discussion in 'PHP' started by omerta, Feb 18, 2008.

  1. #1
    i was writing code (domxml) in php 5
    and when i upload my files to server i realised that server had php 4.

    now problem :(

    how can i load an xml file
    set an attribute
    create an element with some text in the element
    and finally SAVE IT!!!

    so simple but i was searcing too many hours to the internet and i found nothing that could help me.

    Please if you can write a simple script not a link to another site

    Thank you in advance
    CHRIS
     
    omerta, Feb 18, 2008 IP
  2. 00johnny

    00johnny Peon

    Messages:
    149
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    most servers can be configured to run either php 4 or 5. Read your hosts faqs or similar documentation to see if they have the feature.
     
    00johnny, Feb 18, 2008 IP
  3. omerta

    omerta Peon

    Messages:
    19
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I didn't find such an option...
    a small script somebody?

    In php 5 i had this script:

    $xmlDoc = new DomDocument();

    $xmlDoc->load("xml/" . $_POST["category"] . ".xml");

    $pictures = $xmlDoc -> getElementsByTagName("pictures") -> item(0);
    $number=$pictures -> getAttributeNode('number') -> value;
    $number=$number+1;
    $pictures -> setAttribute('number',$number);

    $name = $xmlDoc -> createElement('name', $_FILES["file"]["name"]);

    $pictures -> insertbefore($name,$pictures->firstChild);
    $xmlDoc -> save("xml/" . $_POST["category"] . ".xml");

    How can i return it to php 4?

    please help me.

    Thank u in advance
    Chris
     
    omerta, Feb 19, 2008 IP
  4. InFloW

    InFloW Peon

    Messages:
    1,488
    Likes Received:
    39
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I advise you contact your host inquiring about if you can run PHP5. Reason I say this is PHP4 hit it's end of life and is no longer supported. Almost all hosts are running PHP5 now so I'm confused why your host is still running 4.
     
    InFloW, Feb 19, 2008 IP
  5. omerta

    omerta Peon

    Messages:
    19
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    yes i did that and i am waiting an answer...
    I'am wondering, too, why my host is still running php 4....

    but if someone can write a script i would be grateful:p
     
    omerta, Feb 19, 2008 IP
  6. omerta

    omerta Peon

    Messages:
    19
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    they told me that i must pay sth more in order to transfer my domain name se windows package.
    now it is in linux package...

    how can i save an xml file in php 4??

    It can;t be too difficult....
     
    omerta, Feb 20, 2008 IP