Home > Web Front-end > JS Tutorial > Detailed explanation of php gethostbyname function to obtain domain name IP address_javascript skills

Detailed explanation of php gethostbyname function to obtain domain name IP address_javascript skills

WBOY
Release: 2016-05-16 18:35:48
Original
2022 people have browsed it

Returns the IP address.
gethostbyname syntax: string gethostbyname(string hostname);
gethostbyname return value: string
Function type: network system

gethostbyname content description
This function can return a machine name (Domain Name) IP address (IP Address). If the execution fails, the original machine name is returned.

Usage Example
The return value of gethostbyname in the following example is 61.129.70.67
echo gethostbyaddr("www.jb51.net");
?>
The following is the specific usage code:

Copy the code The code is as follows:

$domain=$_GET["domain"];
$ip = gethostbyname($domain);
echo $ip;
?>

can be passed Just pass the url parameter.
Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template