image
image

Go Back   macosx.com > Design, Media, Programming & Scripting > Software Programming & Web Scripting

Reply
 
Thread Tools
  #1  
Old April 30th, 2008, 08:52 AM
Registered User
 
Join Date: Apr 2008
Posts: 2
jeetesting is on a distinguished road
Need help with PHP script for IP address of sites

Need help with PHP script for IP address of sites

Hi All
I need some assistance with getting the IP address of a web site.

Basically I have to write a PHP page where if a site name is supplied it would return back the IP address of the site as well as specify if the IP Address is Dedicated for that site or a Shared IP Address

I have figured out how to get the IP address of a site in PHP however I am not able to figure out how can I find out whether that IP address is static i.e. dedicated IP for the site or a shared IP that the site is using.

Does anyone know how to get around this problem, using PHP how can I figure out if an IP address of the site is a Dedicated IP address for that site or whether that IP is a shared one.

Any help on this matter is appreciated

Cheers
Asif
Reply With Quote
  #2  
Old May 1st, 2008, 12:07 PM
Captain Code's Avatar
Moderator
 
Join Date: Aug 2001
Location: Ontario, Canada
Posts: 3,085
Captain Code will become famous soon enough
You could try doing a reverse DNS lookup on that IP address. Most likely you will get something else other than the original domain because most websites are hosted on servers with many other web sites.
__________________
MacBook Pro 2.16GHz Core2Duo 3GB RAM, G4 1.4GHz OSX Tiger 1.25GB RAM, Dual 2GHz G5 OSX Tiger 2GB RAM (freakin shweet)
Athlon 64 Windoze XP for school work (programming) 1GB RAM
dferns@macosx.com
Reply With Quote
  #3  
Old May 2nd, 2008, 01:00 AM
Registered User
 
Join Date: Apr 2008
Posts: 2
jeetesting is on a distinguished road
Need help with PHP script for IP address of sites

You could try doing a reverse DNS lookup on that IP address. Most likely you will get something else other than the original domain because most websites are hosted on servers with many other web sites.

----------------------------------------------------------------------------

I need all websites on that ip.

How it's possible using php script?

Any suggestion give me, How can create script other sites hosted on same ip.

Cheers
Asif
Reply With Quote
  #4  
Old May 11th, 2008, 05:58 PM
billbaloney's Avatar
House pianist
 
Join Date: Oct 2000
Location: Brooklyn, NY
Posts: 509
billbaloney is on a distinguished road
Did you ever figure this out?

The first question is this: How would you go about determining a dedicated vs. shared IP programmatically, using any language?

In a shell, I would use dig with the +short=1 flag to get a terse answer.

dig +short mydomain.com
[response: 1.2.3.4]
dig +short -x 1.2.3.4
[response: somedomain.com]

If the response to #2 isn't the same as the domain you started with, then you've *probably* got a shared hosting situation.
__________________
Matt (billbaloney)
1.67GHz "October 2005" G4 Aluminum 1.5 GB RAM, OS 10.5.2
Lots of other things around
Helen Marie
Holford Industries
Reply With Quote
  #5  
Old May 20th, 2008, 06:34 PM
ksv's Avatar
ksv ksv is offline
liberal socialist
 
Join Date: Nov 2000
Location: Trondheim, Norway
Posts: 2,999
ksv is on a distinguished road
Bill's method should work as well as you can get it programatically without having to index the web with a spider or refer to an existing index.

As for checking the IP for a domain, you can use gethostbyname():
http://no.php.net/manual/en/function.gethostbyname.php
__________________
leo at code.coop

Co-operatives are private corporations based on the values of self-help, self-responsibility, democracy, equality, equity and solidarity.
Reply With Quote
Reply

Thread Tools

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off
Forum Jump


All times are GMT -5. The time now is 05:46 PM.


Mac Support® Version 3.7.0 Beta 5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Copyright 2000-2008 DigitalCrowd, Inc.