PHP file_get_contents() and setting request headers

后端 未结 7 962
庸人自扰
庸人自扰 2020-11-22 14:29

With PHP, is it possible to send HTTP headers with file_get_contents() ?

I know you can send the user agent from your php.ini file. However

相关标签:
7条回答
  • 2020-11-22 14:56

    Unfortunately, it doesn't look like file_get_contents() really offers that degree of control. The cURL extension is usually the first to come up, but I would highly recommend the PECL_HTTP extension (http://pecl.php.net/package/pecl_http) for very simple and straightforward HTTP requests. (it's much easier to work with than cURL)

    0 讨论(0)
提交回复
热议问题