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!




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

People are also looking for solutions to the problem: php - Foreach Range with Blank List Entries


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.