api_workpause.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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'] = "0f9ed850-e473-11e2-aaad-ac162db0b20c";
  10. $params['id_work'] = "a0a572e0-4d70-45d7-ac4a-9483933c70b9";
  11. $params['id_reason'] = "прочее";
  12. $params['comment'] = "прочее";
  13. TWXrequest($params);
  14. function TWXrequest($params)
  15. {
  16. $url = "http://devplatform.digitaldepot.ru:8085/Thingworx/Things/2050UserLibraryExp/Services/work_pause";
  17. $jsonEncoded = json_encode($params);
  18. $curl = curl_init();
  19. curl_setopt($curl, CURLOPT_URL, $url);
  20. curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "AppKey: 6a7bdbaa-6bc1-4159-a2f4-07a13c8907d1", "Accept:application/json"));
  21. // curl_setopt($curl, CURLOPT_USERPWD, sprintf('%s:%s', "Smopp", "2050.Digital"));
  22. curl_setopt($curl, CURLOPT_TIMEOUT, 60);
  23. curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  24. curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
  25. curl_setopt($curl, CURLOPT_POST, 1);
  26. curl_setopt($curl, CURLOPT_POSTFIELDS, $jsonEncoded);
  27. curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
  28. curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
  29. // var_dump($jsonEncoded);
  30. $result = curl_exec($curl);
  31. //016 11360336 e6b6b19d-d9c3-11e9-80d5-005056011052
  32. //016 11360328 e6b6b19e-d9c3-11e9-80d5-005056011052
  33. // $uuid = json_decode($result)->RemarkId;
  34. // echo "uuid ".$uuid;
  35. // curl_close($curl);
  36. var_dump($result);
  37. // var_dump($result);
  38. }
  39. ?>