Does the server really receive requests and are you handling the hostname (alias) correctly?
after adding .hosts to my file
Check your web serverβs log to see how the request came ...
curl has options for sending a sent request and a received response, it is called trace, which will be saved in a file.
- trace
If you are missing host or header information, you can force these headers to be configured using the configuration option.
I would get a curl request running on the command line and then try to implement in PHP.
configuration parameter
-K / - config
the parameters that matter in curl are here
- trace Includes a complete dump of all incoming and outgoing data, including descriptive information, in this output file. Use "-" as the file name for output sent to standard output.
This option overrides previous uses of -v/--verbose or --trace-ascii. If this option is used several times, the last one will be used.
-K / - configurations Specify which configuration file to read using the curl arguments. A configuration file is a text file in which command line arguments can be written, which will then be used as if they were written on the actual command line. Parameters and their parameters must be indicated on the same line of the configuration file, separated by a space, a colon, an equal sign, or any combination of them (however, the preferred torus separator is an equal sign). If the parameter must contain spaces, the parameter must be enclosed in quotation marks. The following escape sequences are available in double quotes: \, \ ", \ t, \ n, \ r, and \ v. The backslash preceding any other letter is ignored. If the first column of the configuration line is the character '#', the rest part of the line will be considered as a comment, just write one option behind the physical line in the configuration file.
Specify the filename to -K/--config as '-' to make curl read the file from stdin. Note that to be able to specify a URL in the config file, you need to specify it using the --url option, and not by simply writing the URL on its own line. So, it could look similar to this: url = "http://curl.haxx.se/docs/" Long option names can optionally be given in the config file without the initial double dashes. When curl is invoked, it always (unless -q is used) checks for a default config file and uses it if found. The default config file is checked for in the following places in this order: 1) curl tries to find the "home dir": It first checks for the CURL_HOME and then the HOME environment variables. Failing that, it uses getpwuid() on UNIX-like systems (which returns the home dir given the current user in your system). On Windows, it then checks for the APPDATA variable, or as a last resort the '%USERPROFILE%\Application Data'. 2) On windows, if there is no _curlrc file in the home dir, it checks for one in the same dir the curl executable is placed. On UNIX-like systems, it will simply try to load .curlrc from the deter- mined home dir. # --- Example file --- # this is a comment url = "curl.haxx.se" output = "curlhere.html" user-agent = "superagent/1.0" # and fetch another URL too url = "curl.haxx.se/docs/manpage.html" -O referer = "http://nowhereatall.com/" # --- End of example file --- This option can be used multiple times to load multiple config files.