即使我将内容类型设置为text / plain,CURLOP_POSTFIELDS似乎也会将其覆盖为x-www-form-urlencoded
curl_setopt($ch, CURLOPT_POSTFIELDS, 'username etc..');
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
"type" => "POST",
"Accept" => "*/*",
"Content-Type:" => "text/plain; charset=utf-8",
"X-AjaxPro-Method" => "Authenticate2",
"Accept-Language" => "en-us,en;q=0.5",
"Accept-Encoding" => "gzip, deflate",
"Connection" => "keep-alive",
答案 0 :(得分:2)
您必须在Content-Type后删除冒号。否则,试试这个:
$headers = array(
'type: POST',
'Accept: */*',
'Content-type: text/plain; charset=utf-8',
'X-AjaxPro-Method: Authenticate2',
'Accept-Language: en-us,en;q=0.5',
'Accept-Encoding: gzip, deflate',
'Connection: keep-alive'
);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);