$headers = array(
"Content-type: text/xml;charset=\"utf-8\"",
"Accept: text/xml",
"Cache-Control: no-cache",
"Pragma: no-cache",
"SOAPAction: http://ctitechnology.com/UpsertEntity",
"Content-length: ".strlen($soap_request),
);
$soap_do = curl_init();
curl_setopt($soap_do, CURLOPT_URL, "http://66.7.227.4/tio_ws/ScreeningPartnerWS.asmx");
curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, true);
curl_setopt($soap_do, CURLOPT_POST, true);
curl_setopt($soap_do, CURLOPT_POSTFIELDS, $soap_request); // the SOAP request
curl_setopt($soap_do, CURLOPT_HTTPHEADER, $headers);
curl_setopt($soap_do, CURLOPT_HEADER, true);
curl_setopt($soap_do, CURLINFO_HEADER_OUT, true);
$result = curl_exec($soap_do);
print "Response:\n";
print($result);
print "\n";
if($result === false) {
$error = 'Curl error: ' . curl_error($soap_do);
curl_close($soap_do);
print $error;
} else {
$xml = simplexml_load_string($result);
print_r($xml);
print "\n";
我试图在响应中返回时分割标题(我需要保留标题,将CURLOPT_HEADER变为false会这样做但我需要保持响应的标题完好无损)。目前,我无法解析xml,因为包含了标头。任何智慧都将不胜感激!
答案 0 :(得分:1)
HTTP / 1.1指定任何邮件正文应位于“an empty line (i.e., a line with nothing preceding the CRLF) indicating the end of the header fields”
之后您的问题是answered already here。