Advertisement
Guest User

Untitled

a guest
Apr 17th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. class getPRTG{
  2. var $baseURL = 'https://yourprtgdomain.com/api';
  3. var $authString = '&username=username&password=password$';
  4. public function getDownSensors(){
  5. $options = '/table.json?content=sensors&output=json&columns=objid&filter_status=5';
  6.  
  7. $url = $this->baseURL . $options . $this->authString;
  8. $json = file_get_contents($url);
  9. $obj = json_decode($json);
  10.  
  11. return $obj->sensors;
  12. }
  13.  
  14. public function getSensor($id){
  15. $options = '/getsensordetails.json?id=' . $id;
  16.  
  17. $url = $this->baseURL . $options . $this->authString;
  18. $json = file_get_contents($url);
  19. $obj = json_decode($json);
  20.  
  21. return $obj;
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement