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.
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'));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.