服务器返回 HTTP 500

把自己伪装成浏览器

Some servers (especially requested with SSL) returns 500 in cases when some parameters of request is set incorrect.

To avoid «500 error» (for example) be sure to:

  • set proper "Referer: " header if needed, with

curl_setopt(CURLOPT_REFERER, 'http://site.com/ref_page');

  • set proper "User-Agent: " header, with

curl_setopt(CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)');

by Macik

https://stackoverflow.com/questions/2453207/curl-http-post-keep-getting-500-error-has-no-idea

原文地址:https://www.cnblogs.com/liujx2019/p/13453293.html