【发布时间】:2013-07-05 11:22:03
【问题描述】:
尽管我将内容类型设置为 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",
【问题讨论】:
-
你不能在 CURLOPT_HTTPHEADER 中使用关联数组,你必须像这样添加数组项:array('Content-type: text/plain; charset=utf-8', 'Connection: keep-alive', ... )
标签: php ajax curl http-headers content-type