send basic UDP messages from PHP
<?php | |
$serverIP = '192.168.0.1'; | |
$serverPort = 5000; | |
if ($_REQUEST['cmd']) { | |
$socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); | |
if (!$socket) { | |
error_log("Could not open socket"); | |
} else { | |
socket_sendto($socket, $_REQUEST['cmd'], strlen($_REQUEST['cmd']), 0, $serverIP, $serverPort); | |
socket_close($socket); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment