api_getsectionlist.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. TWXrequest();
  3. function TWXrequest()
  4. {
  5. $params['date'] = time();//explode(' ', microtime())[1];
  6. $params['place'] = 'a84d0a15-08ec-11e5-829d-00155d6cab05';//Братское
  7. // $params['place'] = '5f2e4eca-4b02-11e1-b72e-001517e6ca10'; // Москва-Сортировочная.'5fb47130-580c-11e7-aefa-00155d6cab05';
  8. echo $params['date'];
  9. //$url = "http://62.141.88.61:8085/Thingworx/Things/connSmoppLibrary/Services/get_section_list";
  10. //$url = "http://qaplatform.digitaldepot.ru:8085/Thingworx/Things/connSmoppLibrary/Services/get_section_list";
  11. $url = "http://devplatform.digitaldepot.ru:8085/Thingworx/Things/connSmoppLibrary/Services/get_section_list";
  12. $jsonEncoded = json_encode($params);
  13. $curl = curl_init();
  14. curl_setopt($curl, CURLOPT_URL, $url);
  15. //curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "AppKey: 33cd23bb-3b03-4638-afef-7104a13e9211", "Accept:application/json"));
  16. curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "AppKey: 6a7bdbaa-6bc1-4159-a2f4-07a13c8907d1", "Accept:application/json"));
  17. // curl_setopt($curl, CURLOPT_USERPWD, sprintf('%s:%s', "Smopp", "2050.Digital"));
  18. curl_setopt($curl, CURLOPT_TIMEOUT, 240);
  19. curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  20. curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
  21. curl_setopt($curl, CURLOPT_POST, 1);
  22. curl_setopt($curl, CURLOPT_POSTFIELDS, $jsonEncoded);
  23. curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
  24. curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
  25. // var_dump($jsonEncoded);
  26. $result = curl_exec($curl);
  27. curl_close($curl);
  28. //$uuid = json_decode($result)->RemarkId;
  29. // echo "uuid ".$uuid;
  30. // return $result;
  31. // $json = json_decode($result);
  32. //
  33. var_dump($result);
  34. }
  35. ?>