这是对方的接收的代码
我的post代码是这样的
function request_post($url = '', $param = '') {
if (empty($url) || empty($param)) {
return false;
}
$postUrl = $url;
$curlPost = $param;
$ch = curl_init();//初始化curl
curl_setopt($ch, CURLOPT_URL,$postUrl);//抓取指定网页
curl_setopt($ch, CURLOPT_HEADER, 0);//设置header
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);//要求结果为字符串且输出到屏幕上
curl_setopt($ch, CURLOPT_POST, 1);//post提交方式
curl_setopt($ch, CURLOPT_POSTFIELDS, $curlPost);
$data = curl_exec($ch);//运行curl
curl_close($ch);
return $data;
} $o = "";
foreach ( $post_data as $k => $v )
{
$o.= "$k=" . urlencode( $v ). "&" ;
}
$post_data = substr($o,0,-1);
$url = 'http://121.41.122.74:9111/OrderHandler.ashx?context='.$post_data;
$res = request_post($url, $post_data);
print_r($res);
我的post代码是这样的
function request_post($url = '', $param = '') {
if (empty($url) || empty($param)) {
return false;
}
$postUrl = $url;
$curlPost = $param;
$ch = curl_init();//初始化curl
curl_setopt($ch, CURLOPT_URL,$postUrl);//抓取指定网页
curl_setopt($ch, CURLOPT_HEADER, 0);//设置header
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);//要求结果为字符串且输出到屏幕上
curl_setopt($ch, CURLOPT_POST, 1);//post提交方式
curl_setopt($ch, CURLOPT_POSTFIELDS, $curlPost);
$data = curl_exec($ch);//运行curl
curl_close($ch);
return $data;
} $o = "";
foreach ( $post_data as $k => $v )
{
$o.= "$k=" . urlencode( $v ). "&" ;
}
$post_data = substr($o,0,-1);
$url = 'http://121.41.122.74:9111/OrderHandler.ashx?context='.$post_data;
$res = request_post($url, $post_data);
print_r($res);
<root>
<head>
<func_code>110001</func_code> 功能编码
<deal_time>20160509173045</deal_time> 当前交易时间
</head>
<body>
<BillNum>TEST0001A09XXXYYY</BillNum>
<Date>2016-05-09</Date>
<ConsignorNumber>P15051500001</ConsignorNumber>
<ConsignorContact>张三</ConsignorContact>
<ConsignorMobile>18892718191</ConsignorMobile>
<ConsignorPhone></ConsignorPhone>
<ConsignorAddress>长沙</ConsignorAddress>
<Consignee>李四</Consignee>
<ConsigneeContact>李四</ConsigneeContact>
<ConsigneeMobile>18892718199</ConsigneeMobile>
<ConsigneePhone>073189210101</ConsigneePhone>
<ConsigneeAddress>北京</ConsigneeAddress>
<Delivery>送货</Delivery>
<CollectMoney>2000</CollectMoney>
<Worth>1000</Worth>
<PayMode>现付</PayMode>
<Note>电商订单TEST</Note>
<Prods>
<Prod>
<Type>瓷砖</Type>
<Model>普通</Model>
<ProName>普通</ProName>
<Qty>1</Qty>
<Volume>2</Volume>
<Weight>3</Weight>
</Prod>
</Prods>
<Sign></Sign>
</body>
</root>';