Computer ForumsComputers  

Go Back   Computer Forums > Programmers Lounge > Programming Discussions

Reply
 
LinkBack Thread Tools Display Modes
Old 12-29-2006, 09:16 AM   #1 (permalink)
Super Techie
 
Join Date: Aug 2004
Posts: 277
Send a message via Yahoo to real_in
Default ISP Name from IP address

hi guys,

its been long since i visited this forum, but i always return when things gets tougher for me(mind it for me and not for you guys :P)


well this time, i m here to ask you, how can i fetch an ISP name from the given IP address, i looked around the google, found 2-3 sites, but they all are paid, is there any way else to do that ??

I m using php

thanks a lot guys
__________________
Realin Wuz here ...

real_in is offline   Reply With Quote
Old 12-29-2006, 05:28 PM   #2 (permalink)
Wizard Techie
 
Join Date: Oct 2004
Posts: 4,007
Default

http://www.network-tools.com/

http://www.dnsstuff.com/

Off the top of my head.

Those get who are my internet provider(Enta), but I go through a reseller, which those sigs pick it up (Aquiss)
__________________
Cisco CCNA, Comptia A+
Trifid is offline   Reply With Quote
Old 01-04-2007, 01:27 PM   #3 (permalink)
Newb Techie
 
Join Date: Jan 2007
Posts: 25
Default

Lets see. My php is a little rusty, but I think the following might do what you need.

$strHost = gethostbyaddr($_SERVER['REMOTE_ADDR']);

In my case, this would return something like...

UNIQUEHASH-UNIQUEHASH.cpe.net.cable.rogers.com

I would imagine what you want is just the rogers or the rogers.com. You can perform some string manipulation functions on $strHost to retrieve that.
ryno is offline   Reply With Quote
Old 01-04-2007, 01:32 PM   #4 (permalink)
Super Techie
 
Join Date: Aug 2004
Posts: 277
Send a message via Yahoo to real_in
Default

thanks mate, gonna try this in a min
__________________
Realin Wuz here ...

real_in is offline   Reply With Quote
Old 01-04-2007, 01:38 PM   #5 (permalink)
Super Techie
 
Join Date: Aug 2004
Posts: 277
Send a message via Yahoo to real_in
Default

Warning: gethostbyaddr() [function.gethostbyaddr]: Address is not a valid IPv4 or IPv6 address

mate this the error i got .. my simple code was

<?php

echo gethostbyaddr($_server['REMOTE_ADDR']);

?>


when i tried it on local server, it gave my my computer name, but when i put it online, it gave me this error..
__________________
Realin Wuz here ...

real_in is offline   Reply With Quote
Old 01-04-2007, 01:41 PM   #6 (permalink)
Newb Techie
 
Join Date: Jan 2007
Posts: 25
Default

Lets try to debug this. Output $_SERVER['REMOTE_ADDR'] by itself and post the result.
ryno is offline   Reply With Quote
Old 01-04-2007, 01:47 PM   #7 (permalink)
Super Techie
 
Join Date: Aug 2004
Posts: 277
Send a message via Yahoo to real_in
Default

here is how i changed the code..

<?php

$ip=$_SERVER['REMOTE_ADDR'];
echo"you ip adddress is".$ip;
$isp=gethostbyaddr($ip);
echo $isp;
?>


and the output i got is

you ip adddress is **.**.177.233 **.**.177.233


that means it is returning me the ip address again, instead if ISP name ..
__________________
Realin Wuz here ...

real_in is offline   Reply With Quote
Old 01-04-2007, 01:51 PM   #8 (permalink)
Newb Techie
 
Join Date: Jan 2007
Posts: 25
Default

Hmmm. Can I have the address where you're testing that? It's either just your ISP (hopefully) or a DNS setting on your hosts network.
ryno is offline   Reply With Quote
Old 01-04-2007, 01:53 PM   #9 (permalink)
Super Techie
 
Join Date: Aug 2004
Posts: 277
Send a message via Yahoo to real_in
Default

try here what result you get..

http://realin.co.in/sig/try.php
__________________
Realin Wuz here ...

real_in is offline   Reply With Quote
Old 01-04-2007, 01:56 PM   #10 (permalink)
Newb Techie
 
Join Date: Jan 2007
Posts: 25
Default

you ip adddress is *.*.9.149 SNIP-SNIP.cpe.net.cable.rogers.com

I snipped out my identification, but it seems to work just fine for me.
ryno is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 08:46 AM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0