|
@@ -0,0 +1,28 @@
|
|
|
+<?php
|
|
|
+require_once 'HTTP/Request2.php';
|
|
|
+$request = new HTTP_Request2();
|
|
|
+$request->setUrl('https://prtg.easytelecoms.fr:1616/api/v2/sensors?offset=0&limit=100&filter=&sort_by=&include_all_channels=true');
|
|
|
+$request->setMethod(HTTP_Request2::METHOD_GET);
|
|
|
+$request->setConfig(array(
|
|
|
+ 'follow_redirects' => TRUE,
|
|
|
+ 'ssl_verify_peer' => false,
|
|
|
+ 'ssl_verify_host' => false
|
|
|
+));
|
|
|
+$request->setHeader(array(
|
|
|
+ 'Accept' => 'application/json',
|
|
|
+ 'Authorization' => 'Bearer H57EHLEJBRNAOPH5NRQGKEJRJX4BRTLQ3FVJ7ZAPE4======'
|
|
|
+));
|
|
|
+try {
|
|
|
+ $response = $request->send();
|
|
|
+ if ($response->getStatus() == 200) {
|
|
|
+ echo $response->getBody();
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
|
|
|
+ $response->getReasonPhrase();
|
|
|
+ }
|
|
|
+}
|
|
|
+catch(HTTP_Request2_Exception $e) {
|
|
|
+ echo 'Error: ' . $e->getMessage();
|
|
|
+}
|
|
|
+?>
|