★ wanayoo — archive 1999 http://www.php.net/manual/ja/function.gethostbyaddr.phpNouvelle recherche | Portail wanayoo

PHP Home Page

Manual Table of Contents
Up to ネットワーク
Quick Reference
English version of this pageGerman version of this pageItalian version of this pageFrench version of this pageHungarian version of this page
ネットワーク
* checkdnsrr
* closelog
* debugger_off
* debugger_on
* fsockopen
* gethostbyaddr
* gethostbyname
* gethostbynamel
* getmxrr
* getprotobyname
* getprotobynumber
* getservbyname
* getservbyport
* openlog
* pfsockopen
* socket_set_blocking
* syslog
* ip2long
* long2ip
Manual: gethostbyaddr
View the source code for this pageSearch the site



Previous page
 fsockopen
 Updated
Mon, 14 Aug 2000
gethostbyname 
Next page


gethostbyaddr

(PHP3 , PHP4 )

gethostbyaddr --  指定したIPアドレスに対応するインターネットホスト名を取得する

説明

string gethostbyaddr (string ip_address)

ip_addressで指定したインターネットホストの ホスト名を返します。エラーが発生した場合、 ip_addressを返します。

gethostbyname()も参考にしてください。


User Contributed Notes: gethostbyaddr


php3@bigsky.net
15-Mar-2000 04:34
To check a host's address:
<pre>
$r_hostname = gethostbyaddr($REMOTE_ADDR);
if ($REMOTE_ADDR == "$r_hostname") {
....
}
</pre>

This will fail if a lookup on the name returns the IP as the domain name (which can happen if you control a DNS server), but it's a pretty contrived example, and in any other case it will work.



crusher66@hotmail.com
04-Apr-2000 05:31
Prepend the function with "@" to supress
any error...
<pre>
$r_hostname = @gethostbyaddr($REMOTE_ADDR);
</pre>



scott.kavanagh@netiq.com
11-Aug-2000 03:01
When using the function I am occasionaly seeing a peculiar result on win2k machines.

Specifically, extra characters are returned in front of the hostname. For example if the actual host name is 'blue' I might actually get 'is~blue'.

This may be a peculiar behavior of win2k or perhaps some domain DHCP, etc configuration. Or maybe its a browser issue (i.e. IE5.5 & Win2k).

For now I am just stripping off everything before and including '~'



 About Notes


Previous page
 fsockopen
 Updated
Mon, 14 Aug 2000
gethostbyname 
Next page





Who's responsible for this?
Top of this page

Site
Hosting:



Located in
United States
Elements of this website are subject to copyright.
Questions about installing or using PHP should be directed to one of the mailing lists.
Only questions about the website should be directed to webmaster@php.net.