api_getsectioninfo_dev.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <form>
  2. <p>Субномер:</p>
  3. <input type="text" name="subnumber">
  4. <input type="submit" value="Отправить">
  5. </form>
  6. <?php
  7. $subnumber = $_REQUEST['subnumber'];
  8. $time = date('Y-m-d\TH:i:s');
  9. if ($subnumber) {
  10. var_dump($subnumber);
  11. //$params['subnum_section'] = '11360112';//12730149';//2ЭС5К 0275А
  12. $params['subnum_section'] = $subnumber;
  13. // $params['placeOfRepair'] = "a84d0a15-08ec-11e5-829d-00155d6cab05"; //Братское
  14. $params['mes_time'] = $time;//"2019-10-28T13:00:00";
  15. //var_dump($time);
  16. TWXrequest($params);
  17. }
  18. //11360112 2464928e-d8e9-11e9-80d5-005056011052
  19. function TWXrequest($params)
  20. {
  21. $url = "http://devplatform.digitaldepot.ru:8085/Thingworx/Things/connSmoppLibrary/Services/get_section_info";
  22. $jsonEncoded = json_encode($params);
  23. $curl = curl_init();
  24. curl_setopt($curl, CURLOPT_URL, $url);
  25. curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "AppKey: 33cd23bb-3b03-4638-afef-7104a13e9211", "Accept:application/json"));
  26. // curl_setopt($curl, CURLOPT_USERPWD, sprintf('%s:%s', "Smopp", "2050.Digital"));
  27. curl_setopt($curl, CURLOPT_TIMEOUT, 60);
  28. curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  29. curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
  30. curl_setopt($curl, CURLOPT_POST, 1);
  31. curl_setopt($curl, CURLOPT_POSTFIELDS, $jsonEncoded);
  32. curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
  33. curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
  34. // var_dump($jsonEncoded);
  35. $result = curl_exec($curl);
  36. //016 11360336 e6b6b19d-d9c3-11e9-80d5-005056011052
  37. //016 11360328 e6b6b19e-d9c3-11e9-80d5-005056011052
  38. // $uuid = json_decode($result)->RemarkId;
  39. // echo "uuid ".$uuid;
  40. // curl_close($curl);
  41. var_dump($result);
  42. // var_dump($result);
  43. }
  44. ?>