Hi $HTTP_SERVER_VARS["SERVER_ADDR"]
? Girish -- www.girishnath.co.uk ----- Original Message ----- From: "Balaji Ankem" <[EMAIL PROTECTED]> To: "* R&zE:" <[EMAIL PROTECTED]> Cc: "Php-General" <[EMAIL PROTECTED]> Sent: Monday, February 11, 2002 10:00 AM Subject: [PHP] IP <-> URL No Renze, what I really want is in the calling php file itself I want to get the IP address. Say some test.php..I call this file like http://10.145.2.23/test.php I want to get 10.145.2.23 in test.php file itself. I think parse_url will help me. But I don't know how to pass the current URL itself to test.php file. Thanks in advance -Balaji -----Original Message----- From: * R&zE: [mailto:[EMAIL PROTECTED]] Sent: Monday, February 11, 2002 3:13 PM To: Balaji Ankem Subject: IP <-> URL Hi there, I just found out I probably sent you the wrong answer to your question. What I sent you was how to get the IP-address of the user of your website. But you want to get the IP-address of some URL? So you want the IP of a website? I think it should be something like: ---[php-code]--- if (preg_match ("#^([^:]*://){0,1}[^/]+#", $the_url, $matches)) { $base_url = $matches[1]; $the_ip = gethostbyname($base_url); } else { // Oops... no base URL! } ---[end of php-code]--- I must tell you, though, that I just typed this in this email. I have never use this, and I haven't tested this. So it might need some finetuning and stuff. But I guess it's a good start for solving your problem. Let me know... -- * R&zE: -- »»»»»»»»»»»»»»»»»»»»»»»» -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- «««««««««««««««««««««««« ---------------------------------------------------------------------------- ---- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php