Curl PHP错误,如何修复?
我正在做以下脚本:(MojangAPI) 它给出了这样的答案:Curl PHP错误,如何修复?,php,api,curl,Php,Api,Curl,我正在做以下脚本:(MojangAPI) 它给出了这样的答案: {"error":"Unsupported Media Type","errorMessage":"The server is refusing to service the request because the entity of the request is in a format not supported by the requested resource for the requested method"} 如何修复不
{"error":"Unsupported Media Type","errorMessage":"The server is refusing to service the request because the entity of the request is in a format not supported by the requested resource for the requested method"}
如何修复不支持的媒体类型错误?我是一头奶牛
这行代码
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain'));
说明它是纯文本
但它必须是这样的:
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
我和邮递员试过,邮递员正在工作。
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));