When creating an interface, use file_get_contents to show HTTP request failed! HTTP/1.1 505 HTTP Version Not Supported error. Check the manual,
Note: If you want to open a URL with special characters (such as spaces), you need to use urlencode () for URL encoding.
Remember to encode Chinese before using
Example
| The code is as follows: |
Copy code |
$ Body = file_get_contents ('http: // www.111cn.net '); |
This is no problem. If the path contains Chinese characters or spaces, it will not work.
| The code is as follows: |
Copy code |
$ Body = file_get_contents ('http: // www.111cn.net/Chinese address .html '); |
This will prompt the HTTP request failed! HTTP/1.1 505 HTTP Version Not Supported error
Solution
| The code is as follows: |
Copy code |
$ Body = file_get_contents (urlencode ('http: // www.111cn.net/Chinese address .html ')); |
In this way, it is normal.