Php: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 4: | Line 4: | ||
<?php | <?php | ||
$command = 'ip addr show eth0 | grep -oP "inet \K[\d.]*"'; | $command = 'ip addr show eth0 | grep -oP "inet \K[\d.]*"'; | ||
$ipaddr = shell_exec($command); | $ipaddr = shell_exec($command); | ||
$host = trim($ipaddr); | $host = trim($ipaddr); | ||
echo $host; | echo $host; | ||
?> | ?> | ||
Revision as of 14:12, 20 September 2023
PHP
Contoh menampilkan ip address server
<?php
$command = 'ip addr show eth0 | grep -oP "inet \K[\d.]*"';
$ipaddr = shell_exec($command);
$host = trim($ipaddr);
echo $host;
?>
Koneksi
Database
API
web