Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Init cURL
- $curl = curl_init();
- // Set target URL
- curl_setopt($curl, CURLOPT_URL, "https://api.pingdom.com/api/2.0/traceroute");
- // Set the desired HTTP method (GET is default, see the documentation for each request)
- curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "GET");
- // Set user (email) and password
- curl_setopt($curl, CURLOPT_USERPWD, "sdfsdf.sdfsdf@gmail.com:dsfsdfdfg");
- // Add a http header containing the application key (see the Authentication section of this document)
- curl_setopt($curl, CURLOPT_HTTPHEADER, array("App-Key: nxdq9sfdsfsdfsdfb1trha"));
- // Ask cURL to return the result as a string
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
- // Execute the request and decode the json result into an associative array
- $response = json_decode(curl_exec($curl),true);
- // Website
- $host="website.com";
- // pingdom node
- $probeid="55";
- // Check for errors returned by the API
- if (isset($response['error'])) {
- print "Error: " . $response['error']['errormessage'] . "\n<br>";
- exit;
- }
- $checksList = $response['host'] " &probleid= " $response['probeid'];
- echo $checksList[result];
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement