How could I send SimpleXmlElement object via Curl using POST request type and receive SimpleXmlElement object back.
I made two files on my local server and created object.
URLs:
http://someaddress/fileOne.phphttp://someaddress/fileTwo.php
Object in from first file:
$Xml = new SimpleXMLElement( '<?xml version="1.0" encoding="UTF-8"?><SomeXml></SomeXml>' );
$Translation = $Xml->addChild( 'Translation' );
$Translation->addChild( 'Phrase', 'test' );
and now I would like to send this $Xml object via curl and parse it in other file and send back
$Xml = new SimpleXMLElement( '<?xml version="1.0" encoding="UTF-8"?><SomeXml></SomeXml>' );
$Translation = $Xml->addChild( 'Translation' );
$Translation->addChild( 'Phrase', "Got your phrase: $phrase" );
I would appreciate very much if you could provide code examples.
Thanks everyone for help.
You wouldn’t send the SimpleXMLElement object, you would send the XML data.
From your send side, you would:
Then from your receive side you would just get the request and parse it using SimpleXml.