1,xml报文不用附加"<?xml version="1.0" encoding="UTF-8" ?>",不支持,会报格式错误。
2,提交服务器时要重点注意。
直接使用curl方式的,一定要把数据做http_build_query,千万不要直接放数组里提交。
$params = array(
'xml' => 'your xml',
'verifyCode' => 'your verify code'
);
$parambody = http_build_query($params, '', '&');
curl_setopt($curl, CURLOPT_POSTFIELDS, $parambody);
$params = array(
'xml' => 'your xml',
'verifyCode' => 'your verify code'
);
$response = $client->post(
$uri,
array(
'form_params' => $params,
'headers' => $header,
'verify' => false
)
);
建了个github项目: https://github.com/hVenus/sf-express-api-php
https://packagist.org/packages/hvenus/sf-express-api-php
--END--