SOAP,CURL,PHP没有显示任何错误

时间:2017-06-29 14:46:06

标签: php curl soap

虽然我在页面顶部写了ini_setdisplay错误,但页面是空白的。

error_reporting(E_ALL);
ini_set('display_errors', 1);
$xml_data = '
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <WebLogin xmlns="http://www.example.com/2005/">
      <userLoginPlain>sdf</userLoginPlain>
      <passwordPlain>sdsf</passwordPlain>
      <keyOverride>sdfsdf</keyOverride>
    </WebLogin>
  </soap:Body>
</soap:Envelope>
';
$URL = "https:///exampleff.com/ForumXML.asmx";

$ch = curl_init($URL);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml'));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "$xml_data");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
curl_close($ch);

print_r($output); 

1 个答案:

答案 0 :(得分:2)

因为您收到了XML,请在Chrome中按[F12]查看。

最好使用SOAP-client与SOAP-server进行通信 查看更多http://php.net/manual/en/book.soap.php