Quantcast
Channel: THWACK: Message List
Viewing all articles
Browse latest Browse all 20607

Re: Re: Orion API via PHP

$
0
0

User jfoley posted some PHP code for running a query in this thread: Re: Orion SDK Information

 

ini_set('display_errors', 'On');

  error_reporting(E_ALL);

 

  $endpoint = "https://localhost:17778/SolarWinds/InformationService/v3/Json/Query";

 

  $post_data = array(

  'query' => "SELECT TOP 1 DisplayName, DetailsUrl FROM Orion.Nodes"

  );

 

  $strdata = json_encode($post_data);

 

  $ch = curl_init($endpoint);

 

  curl_setopt($ch, CURLOPT_POST, 1);

  curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);

  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

  curl_setopt($ch, CURLOPT_TIMEOUT, 30);

  curl_setopt($ch, CURLOPT_POSTFIELDS, $strdata);

  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

  curl_setopt($ch, CURLOPT_USERPWD, "admin:");

  //curl_setopt($ch, CURLOPT_HEADER, 1); // This will output response headers

  curl_setopt($ch, CURLOPT_HTTPHEADER, array(

    'Content-Type: application/json',

    'Content-Length: ' . strlen($strdata)

  ));

 

  $result = curl_exec($ch);

  exit("Result: {$result}");


Viewing all articles
Browse latest Browse all 20607

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>