$url = "https://api.flipkart.net/oauth-service/oauth/token\?grant_type\=client_credentials\&scope=Seller_Api";
$curl = curl_init();
$headers = array(
'appid:130783468867102b10c21ab54ba3a7562a68038',
'app-secret:2a27d5f4796a69f27233752fed1380ae91f'
);
$json_data = json_encode($headers);
curl_setopt($curl, CURLOPT_URL,$url);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_HEADER, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $json_data);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
'Content-Type:application/octet-stream',
'Content-Length:'.strlen($json_data),
''
));
$result = curl_exec($curl);
$ee = curl_getinfo($curl);
echo "<pre>";
print_r($ee);
curl_close($curl);
print_r($result);
&GT?; OUTPUT
HTTP / 1.1 400错误请求 服务器:nginx / 1.4.4 日期:星期一,2015年11月23日07:26:51 GMT 内容长度:0 连接:保持活力
答案 0 :(得分:0)
从网址中删除反斜杠。这应该如下所示:
$url = "https://api.flipkart.net/oauth-service/oauth/token?grant_type=client_credentials&scope=Seller_Api";