1

即使我将内容类型设置为 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",
4

1 回答 1

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);
于 2013-07-08T07:54:13.137 回答