我正在为客户端开发 API 脚本,他们需要请求的服务之一需要内容长度。据我所知,PHP 无法在标头中发送 Content-Length。我可能是错的,但没有它,我不断Premature end of data in tag html line 3 [string:Exception:private] => [code:protected] => 0 [file:protected] =>
代码如下所示:
<?
try
{
$soap_url = 'http://admin.stock.imdfulfilment.com/api/service.asmx';
$client = new SoapClient($soap_url);
$header = new SoapHeader(
'http://admin.stock.imdfulfilment.com/api/service/',
'GetCouriers',
array(
'Content-Length' => '255'
)
);
$client->__setSoapHeaders($header);
var_dump($client->__getFunctions());
}
catch (Exception $e)
{
print_r($e);
}