1

Even though I set the content type to text/plain, CURLOP_POSTFIELDS appears to be overwriting it to 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",
1
  • You CANNOT use associative arrays in CURLOPT_HTTPHEADER, you must add array items like this: array('Content-type: text/plain; charset=utf-8', 'Connection: keep-alive', ... ) Commented Sep 4, 2014 at 0:41

1 Answer 1

2

You'll have to remove the colon after Content-Type. Otherwise, try this:

$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);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.