note 106108 deleted from function.file-get-contents by salathe
| From: | salathe@php.net | Date: | Mon, 21 Sep 2020 14:37:32 +0000 |
| Subject: | note 106108 deleted from function.file-get-contents by salathe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-215226@lists.php.net to get a copy of this message | ||
Note Submitter: godwraith01 at yahoo dot com
----
I experienced a problem in using hostnames instead straight IP with some server destinations.
If i use file_get_contents("www.jbossServer.example/app1",...)
i will get an 'Invalid hostname' from the server i'm calling.
This is because file_get_contents probably will rewrite your request after getting the IP, obtaining
the same thing as :
file_get_contents("xxx.yyy.www.zzz/app1",...)
And you know that many servers will deny you access if you go through IP addressing in the request.
With cURL this problem doesn't exists. It resolves the hostname leaving the request as you set
it, so the server is not rude in response.