Advertisement
norman2

ITI-5800SX Remote Control

Jan 24th, 2015
498
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.14 KB | None | 0 0
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  2. <HTML>
  3.     <HEAD>
  4.         <META HTTP-EQUIV="content-type" content="text/html; charset=utf8">
  5.               <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6.  
  7.     </HEAD>
  8.     <BODY>
  9.         <?php
  10.         if (isset($_POST['remote'])) {
  11.             if (isset($_POST['z_reki']) && $_POST['z_reki']) {
  12.                 $remote = $_POST['wys_remote'];
  13.             } else {
  14.                 $remote = $_POST['remote'];
  15.             }
  16.  
  17.             $xml_post_string = '<?xml version="1.0" encoding="utf-8"?>
  18. <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
  19. <s:Body>
  20. <u:ProcessInputEvent xmlns:u="urn:adbglobal.com:service:X_ADB_RemoteControl:1"><InputEvent>ev=keydn,code=' . $remote . '</InputEvent></u:ProcessInputEvent></s:Body>
  21. </s:Envelope>';   // data from the form, e.g. some ID number
  22.             $headers = array("HTTP/1.1",
  23.                 "Content-Length: " . strlen($xml_post_string) + 1,
  24.                 "Content-Type: text/xml;charset=\"utf-8\"",
  25.                 "HOST: 192.168.1.8:8080",
  26.                 "SOAPAction: \"urn:adbglobal.com:service:X_ADB_RemoteControl:1#ProcessInputEvent\"",
  27.                 "User-Agent: SAMSUNG-SGH-I317/internal UPnP/1.0 BH-upnpcp/2.0 DLNADOC/1.50",
  28.             ); //SOAPAction: your op URL
  29.             $url = "http://192.168.1.8:8080/upnpfun/ctrl/uuid_2a11ec20-1dd2-11b2-bf84-0003919f1eb6/04";
  30.             $ch = curl_init();
  31.             curl_setopt($ch, CURLOPT_URL, $url);
  32.             curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  33.             curl_setopt($ch, CURLOPT_POST, true);
  34.             curl_setopt($ch, CURLOPT_POSTFIELDS, $xml_post_string); // the SOAP request
  35.             curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
  36.             $response = curl_exec($ch);
  37.             curl_close($ch);
  38.             //    echo '<xmp>' . $response . '</xmp>';
  39.             $xml_post_string = '<?xml version="1.0" encoding="utf-8"?>
  40. <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
  41. <s:Body>
  42. <u:ProcessInputEvent xmlns:u="urn:adbglobal.com:service:X_ADB_RemoteControl:1"><InputEvent>ev=keyup,code=' . $remote . '</InputEvent></u:ProcessInputEvent></s:Body>
  43. </s:Envelope>';
  44.             $ch = curl_init();
  45.             curl_setopt($ch, CURLOPT_URL, $url);
  46.             curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  47.             curl_setopt($ch, CURLOPT_POST, true);
  48.             curl_setopt($ch, CURLOPT_POSTFIELDS, $xml_post_string); // the SOAP request
  49.             curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
  50.             $response = curl_exec($ch);
  51.             curl_close($ch);
  52.             //   echo '<xmp>' . $response . '</xmp>';
  53.         }
  54.         $klawisze = [
  55.             116 => "POWER"
  56.             , 174 => "HOME"
  57.             , 361 => "VOD"
  58.             , 365 => "EPG"
  59.             , 367 => "APP"
  60.             , 395 => "LIST"
  61.             , 114 => "VOL-"
  62.             , 113 => "MUTE"
  63.             , 115 => "VOL+"
  64.             , 103 => "UP"
  65.             , 108 => "DOWN"
  66.             , 105 => "LEFT"
  67.             , 352 => "OK"
  68.             , 106 => "RIGHT"
  69.             , 357 => "OPT"
  70.             , 358 => "INFO"
  71.             , 402 => "PROG+"
  72.             , 403 => "PROG-"
  73.             , 158 => "BACK"
  74.             , 385 => "RADIO"
  75.             , 102 => "PORTAL"
  76.             , 388 => "TEXT"
  77.             , 398 => "RED"
  78.             , 399 => "GREEN"
  79.             , 400 => "YELLOW"
  80.             , 401 => "BLUE"
  81.             , 128 => "STOP"
  82.             , 207 => "PLAY"
  83.             , 119 => "PAUSE"
  84.             , 167 => "REC"
  85.             , 168 => "<<"
  86.             , 159 => ">>"
  87.             , 2 => "[1]"
  88.             , 3 => "[2]"
  89.             , 4 => "[3]"
  90.             , 5 => "[4]"
  91.             , 6 => "[5]"
  92.             , 7 => "[6]"
  93.             , 8 => "[7]"
  94.             , 9 => "[8]"
  95.             , 10 => "[9]"
  96.             , 11 => "[0]"];
  97.  
  98.         echo '<center><form enctype="multipart/form-data" action="postuj.php" method="POST">
  99.     <table border="0" width="30%" cellspacing="0" cellpadding="1">
  100.     <input type="hidden" name="remote" Id="remote" value="1">
  101.     <input type="hidden" name="z_reki" Id="z_reki" value="">';
  102.         $licznik = 0;
  103.         echo '<tr>';
  104.         foreach ($klawisze as $kod => $nazwa) {
  105.             $licznik++;
  106.             echo '<td><input type="button" value="' . $nazwa . '" onclick="{document.getElementById(\'remote\').value=' . $kod . ';this.form.submit();}"></td>';
  107.             if ($licznik == 3) {
  108.                 echo '</tr><tr>';
  109.                 $licznik = 0;
  110.             }
  111.         }
  112.         if ($licznik < 3 && $licznik > 0) {
  113.             echo '</tr>';
  114.         }
  115.         echo '</table>
  116.      Kod : <input type="text" name="wys_remote" ';
  117.         if (isset($_POST['remote'])) {
  118.             $remote = (int) $_POST['wys_remote'];
  119.  
  120.             echo 'value = "' . $remote . '"';
  121.         }
  122.         echo '><input type="button" name="wysylamy" value="Wyślij" onclick="{document.getElementById(\'z_reki\').value=1;this.form.submit();}"></form></center>';
  123.         ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement