Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: Need help with PHP script for IP address of sites

Hybrid View

  1. #1
    Junior Member
    Join Date
    May 2008
    Posts
    1

    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

  2. #2
    Just Another Geek
    Join Date
    Jul 2002
    Location
    Rotterdam, Netherlands
    Posts
    3,401
    Quote Originally Posted by jeetesting
    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.
    AFAIK there's no way to figure that out remotely.
    Oliver's Law:
    Experience is something you don't get until just after you need it.

  3. #3
    Senior Member nihil's Avatar
    Join Date
    Jul 2003
    Location
    United Kingdom: Bridlington
    Posts
    17,188
    I don't know if this helps but if you type an IP address into your browser's address bar and only that site comes up, then it is dedicated. If more than one comes up then it is shared.

  4. #4
    Just Another Geek
    Join Date
    Jul 2002
    Location
    Rotterdam, Netherlands
    Posts
    3,401
    Quote Originally Posted by nihil
    If more than one comes up then it is shared.
    How can more sites come up? If the site uses virtual hosts (multiple websites on 1 ip) it will just show the default.
    Oliver's Law:
    Experience is something you don't get until just after you need it.

  5. #5
    Senior Member nihil's Avatar
    Join Date
    Jul 2003
    Location
    United Kingdom: Bridlington
    Posts
    17,188
    Sorry SD, I was a bit obtuse with that post.

    If you get a default it won't be the site that you were expecting, so that tells you it is a shared IP?

    As far as I know you cannot find who or how many shares there are, just that there is a share.


  6. #6
    Elite Hacker
    Join Date
    Mar 2003
    Posts
    1,407
    http://us3.php.net/manual/en/functio...ostbynamel.php

    That will at least get you one or more IPs of the site, but I don't know how you would tell if one IP is hosting multiple sites.
    Last edited by skiddieleet; May 3rd, 2008 at 12:21 AM.

  7. #7
    Senior Member
    Join Date
    Oct 2003
    Location
    MA
    Posts
    1,052
    I will show you!

    So for example take a look at my site (oofki.net) it resolves to 74.208.29.120
    If you goto the ip directly it says page cannot be found - it is shared

    Now take a look at antionline.com it resolves to 63.146.109.212
    If you goto the ip directly it goes to this page! - it is dedicated :-)

  8. #8
    Just Another Geek
    Join Date
    Jul 2002
    Location
    Rotterdam, Netherlands
    Posts
    3,401
    Quote Originally Posted by oofki
    So for example take a look at my site (oofki.net) it resolves to 74.208.29.120
    If you goto the ip directly it says page cannot be found - it is shared
    Which means you haven't set it up properly..

    Now take a look at antionline.com it resolves to 63.146.109.212
    If you goto the ip directly it goes to this page! - it is dedicated :-)
    Or AO is the default site..

    Don't get me wrong, I'm just showing you that this isn't a good way to check
    Oliver's Law:
    Experience is something you don't get until just after you need it.

  9. #9
    Senior Member
    Join Date
    Jan 2003
    Posts
    3,915
    Time for a bit of WebServer 101

    SirDice is 100% correct... so for those that don't understand.. here's how it works.

    When you request a webpage (typing a domain name or IP in your browser's address bar)... A request is generated that looks similar to the following (we'll use antionline.com as our example).

    Code:
    GET / HTTP/1.1
    HOST: antionline.com
    Of course your browser puts plenty of other stuff in there, but that's basic enough to work.

    Web Servers (with a few exceptions) can host multiple websites, configured by hostname, ip, etc. The most common (as in the case of purchased web hosting) is by hostname using Virtual Hosts. In this case the site has a default configured site, and then multiple virtual sites. Depending on the setup that default site could be a valid page or a standard server configuration page. Since your browser simply resolves the domain name you provide and connects to the IP Address that it resolves to, it needs a way to specify which virtual host it is looking for. The HOST: header allows this to happen. It is also a requirement in HTTP/1.1.

    The concept that oofki / nihil suggested is flawed... here's an example:

    74.208.75.235 -- Displays: It Works!
    www.securitysentience.com -- Displays: It Works!

    However that sites also hosts:
    www.killthesun.org
    www.numerophobe.com
    Along with a couple of others.

  10. #10
    Dissident 4dm1n brokencrow's Avatar
    Join Date
    Feb 2004
    Location
    Shawnee country
    Posts
    1,243
    Quote Originally Posted by SirDice
    Which means you haven't set it up properly...
    Oofki didn't set that host up. He uses 1and1.com, probably the Linux
    plan. Know them well. They run a tight ship, actually. I think the 404
    page is default.
    “Everybody is ignorant, only on different subjects.” — Will Rogers

Similar Threads

  1. PHP script question
    By Moira in forum General Programming Questions
    Replies: 11
    Last Post: July 17th, 2007, 08:34 AM
  2. Assembly Addressing Scheme
    By neemitjamwal in forum Code Review
    Replies: 6
    Last Post: December 27th, 2003, 07:01 PM
  3. Speeding up PHP script execution
    By PuReExcTacy in forum Web Development
    Replies: 2
    Last Post: September 22nd, 2003, 05:02 AM
  4. Date Encryption
    By CyberSpyder in forum AntiOnline's General Chit Chat
    Replies: 0
    Last Post: March 25th, 2003, 09:31 AM
  5. Subnetting tutorial
    By mountainman in forum Other Tutorials Forum
    Replies: 2
    Last Post: December 21st, 2001, 09:23 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •