[ISP Name from IP address] - Computers



Search Tech-Forums - link takes you to our Forum's search page.

Note: The following is only a text archive!


To view the actual forum discussion, please visit our website at http://www.tech-forums.net

Pages:1



ISP Name from IP address

(Click here to view the original thread with full colors/images)



Posted by: real_in

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 :)



Posted by: Trifid

[url]http://www.network-tools.com/[/url]

[url]http://www.dnsstuff.com/[/url]

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)



Posted by: ryno

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.



Posted by: real_in

thanks mate, gonna try this in a min :)



Posted by: real_in

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



Posted by: ryno

Lets try to debug this. Output $_SERVER['REMOTE_ADDR'] by itself and post the result.



Posted by: real_in

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



Posted by: ryno

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.



Posted by: real_in

try here what result you get..

[url]http://realin.co.in/sig/try.php[/url]



Posted by: ryno

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.



Posted by: real_in

but mann.. it doesn work for me :(

isnt there a way i can get it thru [url]http://DNSstuff.com[/url]

or something like that.. cause this script will return for few and for few it wont :(



Posted by: ryno

You could do it, but the code would be complex, slow and it is most likely illegal. Do you know the address of your DNS server? There might be a better way to do this directly. Of course, if it's your DNS server that's the proble, the results won't be any better.



Posted by: real_in

My DNS server ?? i mean i din get you.. how does my DNS gonna get this all ..



Posted by: SHAWN

[url]http://www.networksolutions.com/whois/index.jsp[/url]

Select the ip address and enter it. It will tell you the ISP.



Posted by: ryno

Your DNS server is what your machine queries for the hostname. It figured it all out, not your machine.



Posted by: real_in

but when i visit, [url]http://danasoft.com[/url] the ISP name is displayed in the pic(signature).

and i know my ISP name .. also [url]http://dnsstuff.com[/url] is the best tool



Posted by: ryno

Does your server and danasoft.com use the same DNS server?



Posted by: real_in

na, i m from india and i belive that site is hosted some where in US. so the DNS servers cant be same.. (sorry for being n00b)



Posted by: ryno

Well... what you might be able to do is write a function that queries the DNS server that dnsstuff.com uses and you could probably get the same results. You would have to find out what DNS server they use though and make sure that you can legally query it in this fashion.



Posted by: real_in

yeah that is the only hope left now.. other wise i have to locally execute a query to my shell, but that wont be safe and i will have to check with my hosting service, if they gonna allow me to do so or no ..

thanks a lot mate.. :)



Posted by: ryno

You're welcome. Sorry I couldn't be more helpful.





vBulletin Copyright ©2000 - 2003, Jelsoft Enterprises Limited.


PPC Management
vB Easy Archive Final - Created by Xenon