1
我想在我的代碼中發佈JSON。
雖然我設置頁眉Content_Type:application/json
接收服務器獲取作爲Content-Type: application/x-www-form-urlencoded
PHP CURL雖然我設置標頭爲應用程序/ json的請求作爲應用程序/ x-www-form-urlencoded
$Content_Type = "application/json";
$header_info = "X_RESTBUS_MESSAGE_ID:".$X_RESTBUS_MESSAGE_ID.","."X_BU_ID:".$X_BU_ID.","."Content_Type:".$Content_Type;
$url = $server_url;
$content = json_encode($body_data);
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER,
array($header_info));
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $content);
$json_response = curl_exec($curl);
$status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
但
13 > X_RESTBUS_MESSAGE_ID: <aaaaa>,X_BU_ID:<xxxx>,Content_Type:application/json
13 > Accept: */*
13 > Content-Type: application/x-www-form-urlencoded
13 > Content-Length: 641
13 > Host: localhost:49111
13 >
是的。我想到了。謝謝 –