0
我使用的是來自FiWare.org的KeyRock。以前一切似乎都可以找到,但現在在用戶授權後的其餘服務器向我發送以下響應。我看過服務器的響應,它似乎是一個空/空的響應。但是在NodeJS上,請求被無縫地處理。我正在使用wp-oauth插件,並將其修改爲與FiWare一起使用。我通過PHP CURL發送此請求。FiWare WP-OAuth用戶認證PHP CURL
{
"error": {
"message": "Expecting to find application/json in Content-Type header - the server could not comply with the request since it is either malformed or otherwise incorrect. The client is assumed to be in error.",
"code": 400,
"title": "Bad Request"
}
}
以下是捲曲要求我使用:
$url = URL_TOKEN . $url_params;
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $params);
curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($curl, CURLOPT_USERPWD, CLIENT_ID . ":" . CLIENT_SECRET);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, (get_option('wpoa_http_util_verify_ssl') == 1 ? 1 : 0));
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, (get_option('wpoa_http_util_verify_ssl') == 1 ? 2 : 0));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($curl);