开发者

How to get IP from "http://" or "www" in PHP?

How do I get something in PHP/Curl to grab the IP of the URL for me? It's going to be a simple interface that fetches URL IP's back for me.开发者_JAVA百科

E.g. Enter "http://mysite.com" then I hit submit then I should get the IP of the mysite.com back.


gethostbyname

$ip_string = gethostbyname( "stackoverflow.com" );
echo $ip_string; //returns ip address, ie 12.34.56.78


Try the gethostbyname function.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜