php curl查看获取请求头-银联云闪付header请求对方接收不到
php curl查看获取请求头-银联云闪付header请求对方接收不到
php curl查看获取请求头-银联云闪付header请求对方接收不到
使用swoft1的crul请求当请求头有大写字母时会转为小写字母,银联云闪付收不到
改用原生CURL请求
设置header
$headers = array(
"bizMethod: ".$header['bizMethod'],
"appId: ".$header['appId'],
"version: ".$header['version'],
"reqId: ".$header['reqId'],
"sign: ".$header['sign'],
"Content-Length: ".strlen($dataStr),
);
发送请求
$url = '';
$data= ''; //json串
$curl = curl_init ();
curl_setopt ( $curl, CURLOPT_URL, $url );
curl_setopt ( $curl, CURLOPT_HEADER, 0 );
curl_setopt ( $curl, CURLOPT_TIMEOUT, 0 );
curl_setopt ( $curl, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt($curl, CURLOPT_HTTPHEADER, array_merge(array('Content-Type: application/json;charset=utf-8'),$headers));//重点
// curl_setopt($curl, CURLINFO_HEADER_OUT, TRUE);//注意加这句用 $info = curl_getinfo($curl);显示请求头
curl_setopt($curl, CURLOPT_POST, 1);//post方式提交
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);//要提交的信息json_encode($data)
$rs = curl_exec ( $curl ); // 执行cURL抓取页面内容
// $info = curl_getinfo($curl);
// var_dump($info);
curl_close ( $curl );
/ var_dump($rs );
php curl查看获取请求头-银联云闪付header请求对方接收不到
|