Page 1 of 1

How to get sender server name from PHP

Posted: Wed Feb 17, 2010 10:25 pm
by emmbec
Hi, I have a form that is sending the data to another server, e.g.

http://www.server1.com/sender.php will POST the data from the form located in that server to http://www.serverremote.com/receiver.php

How can I know in receiver.php the name of the server that sent the POST? I would expect to get something like http://www.server1.com

Is that possible? Is there another way that I can send data from one server to another? I want to build a service in which users will need to create an account on my local server, and put some sort of API in their own website, of course they'll have to pay for it so I would like to provide them with a KEY and then they'll send that to me, but I want to make sure that they are sending it from the specific host that they paid for...

Thanks!

Re: How to get sender server name from PHP

Posted: Wed Feb 17, 2010 10:39 pm
by califdon
The PHP environment variable $_SERVER['HTTP_REFERER'] will normally give you the referring URL, but there are some limitations. See http://www.php.net/manual/en/reserved.v ... server.php.

Re: How to get sender server name from PHP

Posted: Wed Feb 17, 2010 10:43 pm
by emmbec
califdon wrote:The PHP environment variable $_SERVER['HTTP_REFERER'] will normally give you the referring URL, but there are some limitations. See http://www.php.net/manual/en/reserved.v ... server.php.

Thanks, but I would like it to be trust worthy, this seems like a very unsecured method.

Re: How to get sender server name from PHP

Posted: Thu Feb 18, 2010 1:09 am
by requinix
There's nothing trustworthy out there. Not with that method.