hello, I want to save the ip in a variable, I have occurred to me by pinging with console.
And mark that I want the content that is in [ and ].
$host = 'google.es';
function sacarIP($host)
{
exec("ping -n 1 $host", $output, $status);
$ip = $output[1];
return $ip;
}
echo sacarIP($host);
this brings me back to :
Haciendo ping a google.es [142.250.184.3] con 32 bytes de datos: