logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Coding & Scripting Corner View previous topic :: View next topic
Reply to topic   Topic: IP Address resolving
Author
pips



Joined: 03 May 2006
Posts: 65
Location: Manchester, UK

PostPosted: Tue 02 Jan '07 14:07    Post subject: IP Address resolving Reply with quote

I have a piece of software called Sam Spade for Windows which will search out who an IP address belongs to. (free from http://downloads.pcworld.com/pub/new/internet/internet_tools/spade114.exe )
I want to be able to integrate a similar search into one of my PHP webpages.

At present I have used the following php code:-

$ip = gethostbyname(@$REMOTE_ADDR);
$netbios = gethostbyaddr($ip);
$ip_addr = getenv("REMOTE_ADDR");
$agent = getenv("http_user_agent");


to return the following information:-

ip address: 131.107.0.95

resolved to: tide525.microsoft.com

agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; WOW64; SV1; .NET CLR 2.0.50727)


But would like to be able to get the following output (taken from the software) straight from the web-browser (PHP).....

01/02/07 11:45:02 IP block 131.107.0.95
Trying 131.107.0.95 at ARIN
Trying 131.107.0 at ARIN

OrgName: Microsoft Corp
OrgID: MSFT
Address: One Microsoft Way
City: Redmond
StateProv: WA
PostalCode: 98052
Country: US

NetRange: 131.107.0.0 - 131.107.255.255
CIDR: 131.107.0.0/16
NetName: MICROSOFT
NetHandle: NET-131-107-0-0-1
Parent: NET-131-0-0-0-0
NetType: Direct Assignment
NameServer: NS1.MSFT.NET
NameServer: NS5.MSFT.NET
NameServer: NS2.MSFT.NET
NameServer: NS3.MSFT.NET
NameServer: NS4.MSFT.NET
Comment:
RegDate: 1988-11-11
Updated: 2004-12-09

RTechHandle: ZM39-ARIN
RTechName: Microsoft
RTechPhone: +1-425-882-8080
RTechEmail: noc@microsoft.com

OrgAbuseHandle: ABUSE231-ARIN
OrgAbuseName: Abuse
OrgAbusePhone: +1-425-882-8080
OrgAbuseEmail: abuse@microsoft.com

OrgAbuseHandle: HOTMA-ARIN
OrgAbuseName: Hotmail Abuse
OrgAbusePhone: +1-425-882-8080
OrgAbuseEmail: abuse@hotmail.com

OrgAbuseHandle: MSNAB-ARIN
OrgAbuseName: MSN ABUSE
OrgAbusePhone: +1-425-882-8080
OrgAbuseEmail: abuse@msn.com

OrgNOCHandle: ZM23-ARIN
OrgNOCName: Microsoft Corporation
OrgNOCPhone: +1-425-882-8080
OrgNOCEmail: noc@microsoft.com

OrgTechHandle: MSFTP-ARIN
OrgTechName: MSFT-POC
OrgTechPhone: +1-425-882-8080
OrgTechEmail: iprrms@microsoft.com

# ARIN WHOIS database, last updated 2007-01-01 19:10
# Enter ? for additional hints on searching ARIN's WHOIS database.


Anyone got any ideas?

Cheers,
Phil.

Just in case anyone is wondering..... The webpage I have gives you your external web-address and what browser you are using. We use this when on-site at new customers to get their public IP address. It also sends me an email with the details on. Whilst checking the logs from over the Christmas Holidays, I noticed that Microsoft had paid a visit to the page. As the domain isn't advertised I was curious to know why microsoft had shown an interest in our site. Also interesting that they are still using IE6 and .NET2 and not the later versions of the software!!
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7288
Location: Germany, Next to Hamburg

PostPosted: Tue 02 Jan '07 17:12    Post subject: Reply with quote

http://www.phpwhois.com/
http://whois.samscripts.com/demo.htm

NOT TESTED I just googled

php whois lookup
Back to top
pips



Joined: 03 May 2006
Posts: 65
Location: Manchester, UK

PostPosted: Tue 02 Jan '07 19:03    Post subject: Reply with quote

Nice one James!!

I searched before, but for some reason didn't find anything... oh well - I have downloaded the script from phpwhois and took the code from the example.php file and added this to my webpage, then changed a couple of lines of the code, and it all works very well.
Thanks for your help.
Phil
Back to top
chappi



Joined: 08 Apr 2008
Posts: 1

PostPosted: Tue 08 Apr '08 14:03    Post subject: Reply with quote

phpWhois ir right choice.

Queries main regional WHOIS centers: krnic, apnic, ripe, arin, bripw, lacnic, afrinic.
Almost all country code Top Level Domains, including some ones not having whois server
Support for several non-ICANN domains - mobi, fm, tv, ...

Take a look at my public whois server at work - ADMIN Note: links removed.
This spam message has appeared on several forums in the last few days


It works on phpWois, bu I must warn - some work must be done, It's buggy.
Back to top


Reply to topic   Topic: IP Address resolving View previous topic :: View next topic
Post new topic   Forum Index -> Coding & Scripting Corner