IP <-> URL
| From: | Balaji Ankem | Date: | Mon, 11 Feb 2002 10:00:08 +0000 |
| Subject: | IP <-> URL | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-84244@lists.php.net to get a copy of this message | ||
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:renze@datalink.nl]
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: renze@datalink.nl
-- W: +31 23 5326162
-- F: +31 23 5322144
-- M: +31 6 21811143
--
-- Stationsplein 82
-- 2011 LM HAARLEM
-- Netherlands
--
-- http://www.datalink.nl
-- ««««««««««««««««««««««««
**************************Disclaimer************************************ Information contained in this E-MAIL being proprietary to Wipro Limited is 'privileged' and 'confidential' and intended for use only by the individual or entity to which it is addressed. You are notified that any use, copying or dissemination of the information contained in the E-MAIL in any manner whatsoever is strictly prohibited. ********************************************************************
**************************Disclaimer************************************ Information contained in this E-MAIL being proprietary to Wipro Limited is 'privileged' and 'confidential' and intended for use only by the individual or entity to which it is addressed. You are notified that any use, copying or dissemination of the information contained in the E-MAIL in any manner whatsoever is strictly prohibited. ********************************************************************