api_gettest.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. $params['work_id'] = 123;
  3. $params['task_id'] = 324;//"2019-10-28T13:00:00";
  4. $params['measurement_stage'] = 444;//"2019-10-28T13:00:00";
  5. TWXrequest($params);
  6. function TWXrequest($params)
  7. {
  8. $url = "http://qaplatform.digitaldepot.ru:8085/Thingworx/Things/2050UserLibrary/Services/check_hw_measurements_ready";
  9. //$url = "http://qaplatform.digitaldepot.ru:8085/Thingworx/Things/connSmoppLibrary/Services/get_section_info";
  10. $jsonEncoded = json_encode($params);
  11. $curl = curl_init();
  12. curl_setopt($curl, CURLOPT_URL, $url);
  13. curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "AppKey: 33cd23bb-3b03-4638-afef-7104a13e9211", "Accept:application/json"));
  14. // curl_setopt($curl, CURLOPT_USERPWD, sprintf('%s:%s', "Smopp", "2050.Digital"));
  15. curl_setopt($curl, CURLOPT_TIMEOUT, 60);
  16. curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  17. curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
  18. curl_setopt($curl, CURLOPT_POST, 1);
  19. curl_setopt($curl, CURLOPT_POSTFIELDS, $jsonEncoded);
  20. curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
  21. curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
  22. // var_dump($jsonEncoded);
  23. $result = curl_exec($curl);
  24. //016 11360336 e6b6b19d-d9c3-11e9-80d5-005056011052
  25. //016 11360328 e6b6b19e-d9c3-11e9-80d5-005056011052
  26. // $uuid = json_decode($result)->RemarkId;
  27. // echo "uuid ".$uuid;
  28. // curl_close($curl);
  29. var_dump($result);
  30. // var_dump($result);
  31. }
  32. ?>