【发布时间】:2011-08-20 15:25:52
【问题描述】:
我如何使用POST 请求类型通过Curl 发送SimpleXmlElement 对象并接收SimpleXmlElement 对象返回。
我在本地服务器上创建了两个文件并创建了对象。
网址:
http://someaddress/fileOne.phphttp://someaddress/fileTwo.php
来自第一个文件的对象:
$Xml = new SimpleXMLElement( '<?xml version="1.0" encoding="UTF-8"?><SomeXml></SomeXml>' );
$Translation = $Xml->addChild( 'Translation' );
$Translation->addChild( 'Phrase', 'test' );
现在我想通过 curl 发送这个 $Xml 对象并在其他文件中解析并发送回
$Xml = new SimpleXMLElement( '<?xml version="1.0" encoding="UTF-8"?><SomeXml></SomeXml>' );
$Translation = $Xml->addChild( 'Translation' );
$Translation->addChild( 'Phrase', "Got your phrase: $phrase" );
如果您能提供代码示例,我将不胜感激。 谢谢大家的帮助。
【问题讨论】:
-
好的,我们得到了你想要的。现在我们想知道,您尝试过什么? :)
-
我有自己的书面 curl 课程,遗憾的是它是私有的。试图用它来发送这个对象,但据我所知,发送对象是不可能的。