file_get_contents HTTP request failed

后端 未结 2 467

I written simple php code to get some url content but it dosn\'t work it return this error

file_get_contents(http://www.nature.com/nature/journal/v508

2条回答
  •  粉色の甜心
    2021-01-20 08:05

    1. Open the page using your browser and with the console open, see that the server does indeed send a 401 even when page is sent and viewable

    2. On php, open the url in an alternate way to ignore the error (see http://php.net/manual/en/context.http.php)

    3. You'll also notice that it's gzip-encoded, see http://php.net/manual/en/function.gzinflate.php

    Happy hacking!

提交回复
热议问题