如何从远程服务器使用PHP获取客户端计算机名称

时间:2017-03-30 11:57:40

标签: php

我已经在远程服务器应用程序中使用了以下php脚本但是得到了null值::

exec('wmic COMPUTERSYSTEM Get UserName', $user);
$pc_user = (explode('\\',$user[1]));
$download_location = "c:/users/$pc_user[1]/downloads/";

结果:: Array()

但是在本地电脑中我正确地获得了PC用户名。

1 个答案:

答案 0 :(得分:0)

您可以获得以下全面的PHP脚本

$_SERVER['REMOTE_ADDR']; // Returns the IP address of client
$_SERVER['RREMOTE_HOST']; // Returns the Host name of client
$_SERVER['REMOTE_PORT']; // Returns the port being used to communicate