日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 >

php 处理raw数据,php以raw格式传递数据

發(fā)布時間:2025/3/21 50 豆豆
生活随笔 收集整理的這篇文章主要介紹了 php 处理raw数据,php以raw格式传递数据 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

該樓層疑似違規(guī)已被系統(tǒng)折疊?隱藏此樓查看此樓

最近跟京東合作,對接京小康,跟他們交流后明白 php這邊得以raw格式的數(shù)據(jù)區(qū)請求他們的接口

網(wǎng)上也搜索了一些例如下面

function http_post($url, $data_string) {

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

curl_setopt($ch, CURLOPT_HTTPHEADER, array(

'X-AjaxPro-Method:ShowList',

'Content-Type: application/json; charset=utf-8',

'Content-Length: ' . strlen($data_string))

);

curl_setopt($ch, CURLOPT_POST, 1);

curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);

$data = curl_exec($ch);

curl_close($ch);

return $data;

}

還是請求不到,請求參數(shù)是沒問題的 postman測試過可以獲取到數(shù)據(jù)

又查到了一個是這樣的

function curls($url, $data_string) {

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

curl_setopt($ch, CURLOPT_HTTPHEADER, array(

'X-AjaxPro-Method:ShowList',

'User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36' ));

curl_setopt($ch, CURLOPT_POST, 1);

curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);

$data = curl_exec($ch);

curl_close($ch);

return $data;

}

不出所料依然失敗,網(wǎng)上也搜了半天沒有其他的說明了,在此請教萬能的吧友們解決一下在此拜謝了

總結(jié)

以上是生活随笔為你收集整理的php 处理raw数据,php以raw格式传递数据的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。