Advertisement
Guest User

Untitled

a guest
Apr 7th, 2012
405
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. <?php
  2.  
  3. // Init cURL
  4. $curl = curl_init();
  5. // Set target URL
  6. curl_setopt($curl, CURLOPT_URL, "https://api.pingdom.com/api/2.0/traceroute");
  7. // Set the desired HTTP method (GET is default, see the documentation for each request)
  8. curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "GET");
  9. // Set user (email) and password
  10. curl_setopt($curl, CURLOPT_USERPWD, "sdfsdf.sdfsdf@gmail.com:dsfsdfdfg");
  11. // Add a http header containing the application key (see the Authentication section of this document)
  12. curl_setopt($curl, CURLOPT_HTTPHEADER, array("App-Key: nxdq9sfdsfsdfsdfb1trha"));
  13. // Ask cURL to return the result as a string
  14. curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
  15.  
  16. // Execute the request and decode the json result into an associative array
  17. $response = json_decode(curl_exec($curl),true);
  18.  
  19. // Website
  20. $host="website.com";
  21. // pingdom node
  22. $probeid="55";
  23.  
  24. // Check for errors returned by the API
  25. if (isset($response['error'])) {
  26. print "Error: " . $response['error']['errormessage'] . "\n<br>";
  27. exit;
  28. }
  29.  
  30. $checksList = $response['host'] " &probleid= " $response['probeid'];
  31.  
  32. echo $checksList[result];
  33.  
  34. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement