2015-06-09 25 views
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); 

回答

0

你尝试添加应用程序/ JSON在Content-Type头?

BR