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

hi Friend
Thanks for your quick replay.

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

Please advice

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...

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"].

Thanks for your reply

<?php

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

?>

This is the only way to got your server real outside/wan IP

<?php
echo file_get_contents("http://ip6.me/");
?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.