0

I am trying to convert this part of the command cURL to PHP cURL:

-H 'Accept: application/json'

to

curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json')); 

However adding that causes the CURLOPT_POSTFIELDS to not post.

1 Answer 1

1

Content-Type and Accept are two different headers. Instead of setting a the content-type, try this:

curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/json')); 
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.