XML parsing error: poor format? Solution
XML parsing error: poorly formatted location: http://www.xxx.com/admin/order.php? Act = operate row 1, Column 6: http://xxx.com/wuliu.php? Request = <? Xml version = '1. 0' encoding = 'utf-8'?> ----- ^
This error is prompted.
$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);
I printed it like this, and $ resR is an xml data. The format is correct as follows:
RequestOrder>
Wjys2016050564377
2016050564377
1
0
1
421
Warehouse
Qian 'an e-commerce service center
064400
Hebei
Tangshan City
Qian 'an City
Qian 'an e-commerce Valley
0315-7572555
0315-7572555
Qiao He
301, Unit 4, building 25
064400
Hebei
Qian 'an City
5 Wangzhuang pingchange buildings
301, Unit 4, building 25
15232682888
15232682888
0
0
0
Normal order
Xiang Yi Xiang walnut oil 1000
168.00
6944219400234
0
0
1
0
What I don't understand is that the $ url here is an error when I splice the xml file? Why? My goal is to send xml data to an excuse, and I plan to send it through the curl post method.
Below is my curl
Public static function my_curl ($ uri, $ xmlData = array () {$ url = $ uri; // File for receiving xml data $ header = array ("content-type: application/x-www-form-urlencoded; "); // defines the content-type as xml. Note that the array $ 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 );}
I don't know how to do it. please help me.
Reply to discussion (solution)
Why do you need to put the xml document on the url when you use post? then, the data submitted in the simulated post submission is an array .... A little contradictory ..
I don't know what you want to do.
You do not know what the recipient can receive.
I found that you only need to add any characters before the xml data. The system will prompt that the format is not added. The data format required by his Interface
The request adopts the HTTP standard POST protocol, and the request parameters are in xml format. the authentication mode is MD5 verification. The throwing format is: http: // *****. php? Request = Xml & MD5 = XXX & Action = Request command. Encoding format: UTF-8
How can I send it to him ???
This is his entire data request.
Http://xxx.xx.xx.xxx: 850/order. php? Request =
<WaybillNo> 1111102354
<ClientCode> Sp001
<Holiday> 1
& Lt; ReplCost & gt; 20.2
<StmtForm> 0
<TrustClientCode> 111234
Wang San
<TrustUnit> Happy buy
<TrustZipCode> 001
Beijing
<TrustCity> Beijing
Chaoyang District
<TrustAddress> 3D15, Sanlitun SOHO building
<TrustMobile> 13436709024
<TrustTel> 010-3650092
<GetPerson> Lee San
<GetUnit> XXX company
<GetZipCode> 010
<GetProvince> Guangdong
Shenzhen
Luohu District
<GetAddress> room A406, Jingguang Building, No. 1 Renmin South Road
& Lt; GetTel & gt; 755-3456789
<GetMobile> 13436700238
<InsForm> 0
<InsureValue>
& Lt; GoodsValue & gt; 30.45
<WorkType> 0
Xxx </OrderType>
<GoodsName> XXX product
& Lt; GoodsValue & gt; 20.34
00987
0
<ISInvoice> 0 <ISInvoice>
<GoodsName> YYY product
<GoodsValue> 20
00987
0
<ISInvoice> 1 <ISInvoice>
2
<GoodsHav> 2
& MD5 = SDJ21W3E1WRE1SDF2ER34D1RTRE113DF & Action = RequestOrder
For personal notice, see: since the post request is used, the http: // *****. php is the url.
Request = Xml & MD5 = XXX & Action = Request command.
These are parameters. do you want to make these three parameters into an xml document?
You just need to get it.
You just need to get it.
Converts xml data to a string. Then splice the url.
I don't know what you want to do.
You do not know what the recipient can receive.
I want to send a data request to an interface in the following format:
Http://xxx.xx.xx.xxx: 850/order. php? Request =
<WaybillNo> 1111102354
<ClientCode> Sp001
<Holiday> 1
& Lt; ReplCost & gt; 20.2
<StmtForm> 0
<TrustClientCode> 111234
Wang San
<TrustUnit> Happy buy
<TrustZipCode> 001
Beijing
<TrustCity> Beijing
Chaoyang District
<TrustAddress> 3D15, Sanlitun SOHO building
<TrustMobile> 13436709024
<TrustTel> 010-3650092
<GetPerson> Lee San
<GetUnit> XXX company
<GetZipCode> 010
<GetProvince> Guangdong
Shenzhen
Luohu District
<GetAddress> room A406, Jingguang Building, No. 1 Renmin South Road
& Lt; GetTel & gt; 755-3456789
<GetMobile> 13436700238
<InsForm> 0
<InsureValue>
& Lt; GoodsValue & gt; 30.45
<WorkType> 0
Xxx </OrderType>
<GoodsName> XXX product
& Lt; GoodsValue & gt; 20.34
00987
0
<ISInvoice> 0 <ISInvoice>
<GoodsName> YYY product
<GoodsValue> 20
00987
0
<ISInvoice> 1 <ISInvoice>
2
<GoodsHav> 2
& MD5 = SDJ21W3E1WRE1SDF2ER34D1RTRE113DF & Action = RequestOrder
The format must be
The request adopts the HTTP standard POST protocol, and the request parameters are in xml format. the authentication mode is MD5 verification. The throwing format is: http: // *****. php? Request = Xml & MD5 = XXX & Action = Request command. Encoding format: UTF-8
I don't know what you want to do.
You do not know what the recipient can receive.
Provides a set of arrays
Array ('waybillno' => 'wjys2016050564377 ', 'clientcode' => '20170101', 'Holiday' => '1', 'replace St' => '0 ', 'stmtform' => '1', 'trustclientcode' => '000000', 'trustperson' => 'Warehouse ', 'trustunit' => 'business Service Center ', 'trustzipcode' => '123', 'trustprovince '=> 'hebei province', 'trustcity' => 'city', 'trustarea '=> 'city ', 'trustaddress' => 'trang', 'trustmobile' => '000000', 'trusttel' => '055', 'getperson' => 'qiaoh ', 'getunit' => 'unit 301, Unit 4, building 25 ', 'getzipcode' => '123', 'getprovince' => 'hebei province ', 'getcity' => 'city', 'getregion' => 'upgrade', 'getaddress' => 'room 25, Unit 4, 301 ', 'gettel' => '000000', 'getmobile' => '000000', 'insform' => '0', 'inputvalue' => '0 ', 'worktype' => '0', 'ordertype' => 'normal order ', 'goodsinfo' => Array ('good' => Array ('goodsname' => 'xiangyi walnut oil ', 'goodsvalue' => '123 ', 'goodsbarcode' => '20170', 'listtype' => '0', 'isinvoice' => '0',), 'goodsnum' => 1, 'goodsha' => 0 ,)
Since the request adopts the HTTP standard POST protocol
So what do you do in the url?
Since the request adopts the HTTP standard POST protocol
So what do you do in the url?
The example he gave me is not http://xxx.xx.xx.xxx: 850/order. php? Is the Request = xml information like this? Isn't it in the url?
It seems yes.
However, it should be understood that although the data is stored on the url, the access method is post
That is, CURLOPT_POST is true, and CURLOPT_POSTFIELDS is empty (or not)
In POST mode, you need to put the data in CURLOPT_POSTFIELDS,
The parameters placed in the url must be obtained using GET.