I have a blank XML document that I assign to a variable and use simplexml_load_string on it to assign values to variables.
Here is an XML file called test.xml
Code: Select all
<?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>Code: Select all
<?php
$xml = simplexml_load_file("test.xml");
$xml->to = "Jason";
$xml->from = "Toby";
Example: I want to post a string containing
Code: Select all
<?xml version="1.0" encoding="ISO-8859-1"?>
<note>
<to>Jason</to>
<from>Toby</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
Thanks,
Jason