0

hi friends

I have run the one php script live server(www.live.com/samplee.php) . this file access the staging server and run the staging server php file and display the result.

But I need the live server address server name also display in the staging serevr php page result page.

How can i get the live server address?

Please help me

5
Contributors
7
Replies
29
Views
10 Years
Discussion Span
Last Post by bab2501
0

hi Friend
Thanks for your quick replay.

This code get the staging server ip address but I need Live server address

Please advice

0

That code should not give you an ip address, unless the server isnt setup with a host name. I dont understand your problem if you are calling a page on another server you already know the other server's host name...

0

try this:

<?
$address = getenv("REMOTE_ADDR");
echo $address;
// Or simply use a Superglobal ($_SERVER or $_ENV)
$ip = $_SERVER['REMOTE_ADDR'];
?>

The function 'getenv' does not work if your Server API is ASAPI (IIS).
So, try to don't use getenv('REMOTE_ADDR'), but $_SERVER["REMOTE_ADDR"].

0
<?php

echo "server address:".$_SERVER['SERVER_ADDR']."<br/>";

?>

Edited by Ezzaral: Added code tags. Please use them to format any code that you post.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.