您好,欢迎访问一九零五行业门户网

http协议-PHP使用curl_init post 提交json 外部服务器报错

http协议jsonphpcurl
[code=php]$serviceurl = 'http://61.153.225.106:5678/service.asmx/tests';
$ch = curl_init ( $serviceurl );
curl_setopt ( $ch, curlopt_customrequest, post );
curl_setopt ( $ch, curlopt_returntransfer, true );
curl_setopt ( $ch, curlopt_postfields, $strjson ); //全部数据使用http协议的post操作来发送
curl_setopt ( $ch, curlopt_ssl_verifypeer, false );
curl_setopt ( $ch, curlopt_ssl_verifyhost, false );
curl_setopt ( $ch, curlopt_httpheader, array (
'content-type: application/json; charset=utf-8;',
'content-length: ' . strlen ( $strjson )
) );
curl_setopt($ch,curlopt_post,1);
$result = curl_exec ( $ch );
$errorno = curl_errno ( $ch );
echo $errorno.
; //错误号 输出0
echo error:.curl_error($ch);
echo $result.
; //执行信息 报错
curl_close ( $ch );[/code]
json字符串:{ccode:1234ew4 , ddate:2015-12-16, ccuscode:0100001, cinvcode:100101, iquantity:1, address:测试地址, cmemo:无, cmaker:demo, cverifer:demo, dpredate:2015-12-17, imoney:1}
其中ccode是需要变化的,同一个插入不进去。
报错信息
[img=http://img.bbs.csdn.net/upload/201512/18/1450420302_248471.jpg][/img]
由于是往第三方插入数据,所以没法改变上传的形式 ,只能上传json格式。
另外如果网页中输入 http://61.153.225.106:5678/service.asmx/tests 然后再输入字符串是可以返回字符串的。完了以后就想是不是传送协议问题,但是我传的又确实是 content-type 为json的数据 。求大神指教,只有12分全部送上
其它类似信息

推荐信息