如何通过Curl
发送SimpleXmlElement
对象使用POST
请求类型并接收SimpleXmlElement
对象返回。使用POST请求通过卷发发送SimpleXmlElement
我在本地服务器上创建了两个文件并创建了对象。
网址:
http://someaddress/fileOne.php
http://someaddress/fileTwo.php
对象从第一个文件:
$Xml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><SomeXml></SomeXml>');
$Translation = $Xml->addChild('Translation');
$Translation->addChild('Phrase', 'test');
,现在我想通过卷曲发送此$Xml
对象和解析它在其他文件中发回
$Xml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><SomeXml></SomeXml>');
$Translation = $Xml->addChild('Translation');
$Translation->addChild('Phrase', "Got your phrase: $phrase");
如果您能提供代码示例,我将非常感激。 谢谢大家的帮助。
好的,我们有你想要的。现在我们想知道,你有什么尝试? :) – Shef
我有我自己的书面卷曲类,可悲的是它是私人的。试图用它来发送这个对象,但正如我从答案中理解的那样,发送对象是不可能的。 – Eugene