开发者

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

开发者 https://www.devze.com 2023-01-17 21:40 出处:网络
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百科

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

精彩评论

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