1
yoyicue 2012-03-18 15:42:52 +08:00
看了看部门API的实例,用的是这个:
http://php.net/manual/en/class.soapclient.php |
2
yoyicue 2012-03-18 15:44:17 +08:00
|
3
csx163 OP @yoyicue 谢谢您的回复,我现在是用curl_setopt() POST下面这段xml获得上面的那段XML. soapclient这个类我试了很久都没有成功将下面这段XML POST到服务器,我现在的意思是反正已经获得了上面那段XML,如何将它转换为数组.
$xml_data ='<v:Envelope xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:d="http://www.w3.org/2001/XMLSchema" xmlns:c="http://schemas.xmlsoap.org/soap/encoding/" xmlns:v="http://schemas.xmlsoap.org/soap/envelope/"><v:Header /><v:Body><jkjl xmlns="http://test" id="o0" c:root="1"><hphm i:type="d:string">'. $a .'</hphm><hpzl i:type="d:string">02</hpzl><fdjh i:type="d:string">'. $b .'</fdjh><an i:type="d:string">android_client</an></jkjl></v:Body></v:Envelope>'; $url = "http://8.8.8.8/test.asmx"; $header[] = "Content-type: text/xml";//定义content-type为xml curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HTTPHEADER, $header); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $xml_data); $response = curl_exec($ch); print_r ($response); |