Get IP address using gethostbyname() function

This Tutorial Has Been Viewed 4,994 Times.

 gethostbyname() is used to get the IP address corresponding to a given Internet host name.

Examples code:

<?php
$ip 
gethostbyname(‘www.mistonline.in’);
echo 
$ip;
?>One way to discover your IP address automatically:
<?php
// need to trim() because whitespace will confuse the name lookup
$myIP gethostbyname(trim(`hostname`));
echo 
$myIP;
?>

VN:F [1.9.13_1145]
Rating: 6.0/10 (3 votes cast)
VN:F [1.9.13_1145]
Rating: 0 (from 2 votes)

Get IP address using gethostbyname() function, 6.0 out of 10 based on 3 ratings

Incoming search terms:





You will also be interested in ,

Tags: , ,

7 Responses

  1. BypeWhomypewhz says:

    Sounds cool……………

    VA:F [1.9.13_1145]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.13_1145]
    Rating: 0 (from 0 votes)
  2. notapionnaistfsk says:

    hmm nice one…

    VA:F [1.9.13_1145]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.13_1145]
    Rating: 0 (from 0 votes)
  3. Bashchuxustahihj says:

    nice website..

    VA:F [1.9.13_1145]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.13_1145]
    Rating: 0 (from 0 votes)
  4. MaizelirlMamsrtn says:

    hmm good..

    VA:F [1.9.13_1145]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.13_1145]
    Rating: 0 (from 0 votes)
  5. scurcisultusyehz says:

    cool..

    VA:F [1.9.13_1145]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.13_1145]
    Rating: 0 (from 0 votes)
  6. Poeveinsek says:

    Good website….

    VA:F [1.9.13_1145]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.13_1145]
    Rating: 0 (from 0 votes)
  7. Phil Young says:

    gud one :)

    VA:F [1.9.13_1145]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.13_1145]
    Rating: 0 (from 0 votes)

Leave a Reply

Spam protection by WP Captcha-Free

Proudly designed by Mistonline.in.
Affordable Seo PackagesSeo BlogEdu Backlinks
More in PHP, scripts (123 of 149 articles)