Pyh.conf’25: a new PHP conference for the Russian-speaking community

Voting

: min(four, one)?
(Example: nine)

The Note You're Voting On

goldemish at tiscali dot it
19 years ago
Function to send Magic Packets for Wake on Wan (WOW) or Wake on Lan(WOL), without sockets library.

<?
function WakeOnLan($ip, $mac, $port)
{
$packet = "";
for($i = 0; $i < 6; $i++) $packet .= chr(0xFF);
for($i = 0; $i < 6; $i++) $packet .= chr((int)substr($mac, $i, $i + 2));
$nic = fsockopen("udp://" . $ip, $port));
if($nic==false){
return false;
fclose($nic);
}
fwrite($nic, $packet);
fclose($nic);
return true;
}
?>

<< Back to user notes page

To Top