How to get sender server name from PHP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
emmbec
Forum Contributor
Posts: 112
Joined: Thu Sep 21, 2006 12:19 pm
Location: Queretaro, Mexico

How to get sender server name from PHP

Post 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!
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: How to get sender server name from PHP

Post 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.
User avatar
emmbec
Forum Contributor
Posts: 112
Joined: Thu Sep 21, 2006 12:19 pm
Location: Queretaro, Mexico

Re: How to get sender server name from PHP

Post 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.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: How to get sender server name from PHP

Post by requinix »

There's nothing trustworthy out there. Not with that method.
Post Reply