Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- $myip = $hostIP; //Doesn't seem to be really used
- $mymac = "00-0c-29-3e-b1-4f"; //Used for the access control/validation, but not after that AFAIK
- $appstring = "PHP..samsung"; //What the iPhone app reports
- $tvappstring = "PHP.UE40D8005.samsung"; //Might need changing to match your TV type
- $remotename = "PHP Remote"; //What gets reported when it asks for permission/also shows in General->Wireless Remote Control menu
- $sock = socket_create(AF_INET, SOCK_STREAM, getprotobyname('tcp'));
- $result = socket_connect($sock, $tvip, '55000');
- if( $result === false)
- die ("Could not create socket: <br />");
- $ipencoded = base64_encode($myip);
- $macencoded = base64_encode($mymac);
- $messagepart1 = chr(0x64) . chr(0x00) . chr(strlen($ipencoded)) . chr(0x00) . $ipencoded . chr(strlen($macencoded)) . chr(0x00) . $macencoded . chr(strlen(base64_encode($remotename))) . chr(0x00) . base64_encode($remotename);
- $part1 = chr(0x00) . chr(strlen($appstring)) . chr(0x00) . $appstring . chr(strlen($messagepart1)) . chr(0x00) . $messagepart1;
- socket_write($sock, $part1, strlen($part1));
- echo $part1;
- echo "\n";
- $messagepart2 = chr(0xc8) . chr(0x00);
- $part2 = chr(0x00) . chr(strlen($appstring)) . chr(0x00) . $appstring . chr(strlen($messagepart2)) . chr(0x00) . $messagepart2;
- socket_write($sock, $part2, strlen($part2));
- echo $part2;
- echo "<br />";
- $key = "KEY_INFO";
- $messagepart3 = chr(0x00) . chr(0x00) . chr(0x00) . chr(strlen(base64_encode($key))) . chr(0x00) . base64_encode($key);
- $part3 = chr(0x00) . chr(strlen($tvappstring)) . chr(0x00) . $tvappstring . chr(strlen($messagepart3)) . chr(0x00) . $messagepart3;
- socket_write($sock,$part3,strlen($part3));
- echo $part3;
- echo "<br />";
- socket_close($sock);
- echo "<br /><br />";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement