HTTP request failed! HTTP/1.1 505 HTTP Version Not Supported error

前端 未结 6 2050
野趣味
野趣味 2020-12-07 01:27

I\'m trying to use file_get_contents() to get the response from a server and this error was encountered. Could someone tell me what is the reason and how to fix

6条回答
  •  难免孤独
    2020-12-07 01:57

    I ran into the same issue and in my case the culprit was an errant newline/CRLF character at the end of the request URL, which does not get caught by urlencode() (or maybe it does encode it but it still causes the server to produce the error). Once I found the problem the requests began to work again, even without the stream context options.

    Hopefully this will help others.

提交回复
热议问题