传递生产服务器时,内容类型始终为null
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://xxxxx/oauth2/token");
$params = http_build_query(array(
'redirect_uri' => 'http://xxxx',
'grant_type' => 'authorization_code',
'code' => '3423424234'
));
curl_setopt($curl, CURLOPT_HEADER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Accept: application/json','Content-Type: application/x-www-form-urlencoded',$encodeID)); //setting custom header
curl_setopt($curl, CURLOPT_POST,1);
curl_setopt($curl, CURLOPT_POSTFIELDS,$params);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($curl);
if(curl_exec($curl) === false)
{
echo 'Curl error: ' . curl_error($curl);
}
curl_close($curl);
这是以下curl响应的输出
["url"]=> string(41) "https://xxxx/oauth2/token" ["content_type"]=> NULL ["http_code"]=> int(0) ["header_size"]=> int(0) ["request_size"]=> int(0) ["filetime"]=> int(0) ["ssl_verify_result"]=> int(0) ["redirect_count"]=> int(0) ["total_time"]=> float(0) ["namelookup_time"]=> float(0) ["connect_time"]=> float(0) ["pretransfer_time"]=> float(0) ["size_upload"]=> float(0) ["size_download"]=> float(0) ["speed_download"]=> float(0) ["speed_upload"]=> float(0) ["download_content_length"]=> float(-1) ["upload_content_length"]=> float(-1) ["starttransfer_time"]=> float(0) ["redirect_time"]=> float(0) ["redirect_url"]=> string(0) "" ["primary_ip"]=> string(0) "" ["certinfo"]=> array(0) { } ["primary_port"]=> int(0) ["local_ip"]=> string(0) "" ["local_port"]=> int(0)
请帮助thanxs: - )