api_myworks.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. //$params['user_id'] = "0231698c-e473-11e2-aaad-ac162db0b20c"; //kandabaev
  10. $params['user_id'] = "023169da-e473-11e2-aaad-ac162db0b20c"; //Kotov
  11. //023169a0-e473-11e2-aaad-ac162db0b20c //Киндрачук
  12. // $params['id_work'] = "9957c42a-234f-4f8e-99e7-1b4f6165a422";
  13. // $params['id_reason'] = "прочее";
  14. // $params['comment'] = "прочее";
  15. TWXrequest($params);
  16. function TWXrequest($params)
  17. {
  18. $url = "http://devplatform.digitaldepot.ru:8085/Thingworx/Things/2050UserLibraryExp/Services/my_works";
  19. $jsonEncoded = json_encode($params);
  20. $curl = curl_init();
  21. curl_setopt($curl, CURLOPT_URL, $url);
  22. curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "AppKey: 6a7bdbaa-6bc1-4159-a2f4-07a13c8907d1", "Accept:application/json"));
  23. // curl_setopt($curl, CURLOPT_USERPWD, sprintf('%s:%s', "Smopp", "2050.Digital"));
  24. curl_setopt($curl, CURLOPT_TIMEOUT, 60);
  25. curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  26. curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
  27. curl_setopt($curl, CURLOPT_POST, 1);
  28. curl_setopt($curl, CURLOPT_POSTFIELDS, $jsonEncoded);
  29. curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
  30. curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
  31. // var_dump($jsonEncoded);
  32. $result = curl_exec($curl);
  33. //016 11360336 e6b6b19d-d9c3-11e9-80d5-005056011052
  34. //016 11360328 e6b6b19e-d9c3-11e9-80d5-005056011052
  35. // $uuid = json_decode($result)->RemarkId;
  36. // echo "uuid ".$uuid;
  37. // curl_close($curl);
  38. var_dump($result);
  39. // var_dump($result);
  40. }
  41. ?>