apache - PHP cURL get requesting host
I have two PHP based sites http://domain1.tld and http://domain2.tld. From domain1.tld I start a cURL (get) request to domain2.tld.
How can I get the requesting host ("domain1.tld")?
I triedvar_dump($_SERVER)
andvar_dump(apache_request_headers())
but these didn't give me the requesting host.
One more important information: domain2.tld is running in CGI mode.
Many thanks in advance!
Answer
Solution:
use the $_SERVER super global on http://domain2.tld
You can try either
$_SERVER["REMOTE_HOST"]
for the host name,and if that doesn't work, the
$_SERVER["REMOTE_ADDR"]
will give you the corresponding IP-address