1
我想通过curl接收xml文件并作出回应。 网站“A”发送XML信息到网站“B”, 网站“B”必须为“A”发送并用curl响应
我知道如何通过邮局数组做到这一点,但不能用XML做回应回
网站“A”发送此
$xml_data ='<test_data>
<one>
<demo>123</demo>
<demo2>456</demo2>
<Password>mypassword</Password>
</one>
</test_data>';
$url = "http://www.domain.com/path/";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml'));
curl_setopt($ch, CURLOPT_POSTFIELDS, "$xml_data");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
curl_close($ch);
网站“B”需要得到这一点,并检查数据和数据库,然后用一个消息可以说进行回应
$xml_data ='<test_data>
<one>
<checked>success</checked>
<demo>123</demo>
<demo2>456</demo2>
<Password>mypassword</Password>
</one>
</test_data>';
我如何 'A' 响应之前查阅网站的数据? – timeout