xml 解析错误:格式不佳位置:http://www.xxx.com/admin/order.php?act=operate行 1,列 6:http://xxx.com/wuliu.php?request=<?xml version='1.0' encoding='utf-8'?>-----^
$wj_curl = new wj_curl(); //var_dump($wj_curl :: ss()); $resr = $wj_curl -> xmlencode($requestorderviews); //print_r($resr); $url = 'http://xxxx.com/wuliu.php?request='.$resr.'&md5='.$md5.'&action=requestorder'; print_r($url);
requestorder><waybillno>wjys2016050564377</waybillno><clientcode>2016050564377</clientcode><holiday>1</holiday><replcost>0</replcost><stmtform>1</stmtform><trustclientcode>421</trustclientcode><trustperson>仓库</trustperson><trustunit>迁安市电子商务服务中心</trustunit><trustzipcode>064400</trustzipcode><trustprovince>河北省</trustprovince><trustcity>唐山市</trustcity><trustarea>迁安市</trustarea><trustaddress>迁安电商谷</trustaddress><trustmobile>0315-7572555</trustmobile><trusttel>0315-7572555</trusttel><getperson>乔鹤</getperson><getunit>25号楼四单元301</getunit><getzipcode>064400</getzipcode><getprovince>河北省</getprovince><getcity>迁安市</getcity><getarea>5 大王庄平改楼</getarea><getaddress>25号楼四单元301</getaddress><gettel>15232682888</gettel><getmobile>15232682888</getmobile><insform>0</insform><insurevalue>0</insurevalue><worktype>0</worktype><ordertype>普通订单</ordertype><goodsinfo><good><goodsname>乡伊香核桃油 1000ml</goodsname><goodsvalue>168.00</goodsvalue><goodsbarcode>6944219400234</goodsbarcode><listtype>0</listtype><isinvoice>0</isinvoice></good></goodsinfo><goodsnum>1</goodsnum><goodshav>0</goodshav></requestorder>
public static function my_curl($uri,$xmldata=array()){ $url = $uri; //接收xml数据的文件 $header = array("content-type: application/x-www-form-urlencoded;"); //定义content-type为xml,注意是数组 $ch = curl_init ($url); curl_setopt($ch, curlopt_url, $url); curl_setopt($ch, curlopt_returntransfer, true); curl_setopt($ch, curlopt_httpheader, $header); curl_setopt($ch, curlopt_post, 1); curl_setopt($ch, curlopt_postfields, $xmldata); $response = curl_exec($ch); if(curl_errno($ch)){ print curl_error($ch); } curl_close($ch); }
你都用post了 为什么要把xml文档放在url上面呢, 然后你模拟的post提交 里面提交的数据还是数组。。。。有点矛盾。。
不知道你要干什么
也不知道对方能接收什么
我发现 只要是在xml数据前面加上任何字符。都会提示格式不加。 那他的接口要求的数据格式
请求采用HTTP标准的POST协议采用,请求参数通过xml格式,验证的模式定为MD5验证。抛送格式为:http://*****.php?Request=Xml&MD5=XXX&Action=请求指令。编码格式为:UTF-8
这是他的整个数据请求
http://xxx.xx.xx.xxx:850/order.php?Request=<RequestOrder> < WaybillNo>1111102354</ WaybillNo>< ClientCode>Sp001</ ClientCode>< Holiday>1</ Holiday>< ReplCost>20.2</ ReplCost>< StmtForm>0</ StmtForm>< TrustClientCode>111234</ TrustClientCode><TrustPerson>王三</ TrustPerson>< TrustUnit>好乐买</ TrustUnit>< TrustZipCode>001</ TrustZipCode><TrustProvince>北京</ TrustProvince>< TrustCity>北京市</ TrustCity><TrustArea>朝阳区</TrustArea>< TrustAddress>三里屯SOHO大厦3D15层</ TrustAddress>< TrustMobile>13436709024</ TrustMobile>< TrustTel>010-3650092</ TrustTel>< GetPerson>李三</ GetPerson>< GetUnit>XXX公司</ GetUnit>< GetZipCode>010</ GetZipCode>< GetProvince>广东省</ GetProvince><GetCity>深圳市</ GetCity><GetArea>罗湖区</ GetArea>< GetAddress>人民南路1号京广大厦A406室</ GetAddress>< GetTel>755-3456789</ GetTel>< GetMobile>13436700238</ GetMobile>< InsForm>0</ InsForm>< InsureValue></ InsureValue>< GoodsValue>30.45</ GoodsValue>< WorkType>0</ WorkType><OrderType>xxx< /OrderType><GoodsInfo><Good>< GoodsName>XXX商品</ GoodsName>< GoodsValue >20.34 </ GoodsValue ><GoodsBarCode>00987</ GoodsBarCode><ListType>0</ ListType>< ISInvoice>0< ISInvoice></Good><Good>< GoodsName>YYY商品</ GoodsName>< GoodsValue >20 </ GoodsValue ><GoodsBarCode>00987</ GoodsBarCode><ListType>0</ ListType>< ISInvoice>1< ISInvoice></Good></GoodsInfo><GoodsNum>2</GoodsNum>< GoodsHav>2</ GoodsHav></ RequestOrder>&MD5=SDJ21W3E1WRE1SDF2ER34D1RTRE113DF&Action=RequestOrder
个人拙见:他既然要用post请求, 那http://*****.php 这个就是 url
Request=Xml&MD5=XXX&Action=请求指令。
这些就是参数,是不是要把这个三个参数组成xml文档?
那你直接get过去就行了啊
那你直接get过去就行了啊
不知道你要干什么
也不知道对方能接收什么
http://xxx.xx.xx.xxx:850/order.php?Request=<RequestOrder> < WaybillNo>1111102354</ WaybillNo>< ClientCode>Sp001</ ClientCode>< Holiday>1</ Holiday>< ReplCost>20.2</ ReplCost>< StmtForm>0</ StmtForm>< TrustClientCode>111234</ TrustClientCode><TrustPerson>王三</ TrustPerson>< TrustUnit>好乐买</ TrustUnit>< TrustZipCode>001</ TrustZipCode><TrustProvince>北京</ TrustProvince>< TrustCity>北京市</ TrustCity><TrustArea>朝阳区</TrustArea>< TrustAddress>三里屯SOHO大厦3D15层</ TrustAddress>< TrustMobile>13436709024</ TrustMobile>< TrustTel>010-3650092</ TrustTel>< GetPerson>李三</ GetPerson>< GetUnit>XXX公司</ GetUnit>< GetZipCode>010</ GetZipCode>< GetProvince>广东省</ GetProvince><GetCity>深圳市</ GetCity><GetArea>罗湖区</ GetArea>< GetAddress>人民南路1号京广大厦A406室</ GetAddress>< GetTel>755-3456789</ GetTel>< GetMobile>13436700238</ GetMobile>< InsForm>0</ InsForm>< InsureValue></ InsureValue>< GoodsValue>30.45</ GoodsValue>< WorkType>0</ WorkType><OrderType>xxx< /OrderType><GoodsInfo><Good>< GoodsName>XXX商品</ GoodsName>< GoodsValue >20.34 </ GoodsValue ><GoodsBarCode>00987</ GoodsBarCode><ListType>0</ ListType>< ISInvoice>0< ISInvoice></Good><Good>< GoodsName>YYY商品</ GoodsName>< GoodsValue >20 </ GoodsValue ><GoodsBarCode>00987</ GoodsBarCode><ListType>0</ ListType>< ISInvoice>1< ISInvoice></Good></GoodsInfo><GoodsNum>2</GoodsNum>< GoodsHav>2</ GoodsHav></ RequestOrder>&MD5=SDJ21W3E1WRE1SDF2ER34D1RTRE113DF&Action=RequestOrder
请求采用HTTP标准的POST协议采用,请求参数通过xml格式,验证的模式定为MD5验证。抛送格式为:http://*****.php?Request=Xml&MD5=XXX&Action=请求指令。编码格式为:UTF-8
不知道你要干什么
也不知道对方能接收什么
Array( 'WaybillNo' => 'wjys2016050564377', 'ClientCode' => '2016050564377', 'Holiday' => '1', 'ReplCost' => '0', 'StmtForm' => '1', 'TrustClientCode' => '421', 'TrustPerson' =>'仓库', 'TrustUnit' => '商务服务中心', 'TrustZipCode' => '064400', 'TrustProvince' => '河北省', 'TrustCity' => '市', 'TrustArea' => '市', 'TrustAddress' => '谷', 'TrustMobile' => '0355', 'TrustTel' => '055', 'GetPerson' => '乔鹤', 'GetUnit' => '25号楼四单元301', 'GetZipCode' => '064400', 'GetProvince' => '河北省', 'GetCity' => '市', 'GetArea' => '平改楼', 'GetAddress' => '25号楼四单元301', 'GetTel' => '15232682888', 'GetMobile' => '15232682888', 'InsForm' => '0', 'InsureValue' => '0', 'WorkType' => '0', 'OrderType' => '普通订单', 'GoodsInfo' => Array ( 'Good' => Array ( 'GoodsName' => '乡伊香核桃油', 'GoodsValue' => '168', 'GoodsBarCode' => '6944219400234', 'ListType' => '0', 'ISInvoice' => '0', ), ), 'GoodsNum' => 1, 'GoodsHav' => 0,)
既然是 请求采用HTTP标准的POST协议
那么你放在 url 里做什么?
既然是 请求采用HTTP标准的POST协议
那么你放在 url 里做什么?
好像是的
但应理解为,虽然数据放在了 url 上,但访问方式还是 post 的
即:CURLOPT_POST 为真,CURLOPT_POSTFIELDS 为空(或没有)
用POST方式,需要把数据放在CURLOPT_POSTFIELDS,
而放在url的参数要用GET来获取
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号