-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathtest2.php
More file actions
35 lines (29 loc) · 801 Bytes
/
test2.php
File metadata and controls
35 lines (29 loc) · 801 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
require_once('uptimerobot.class.php');
$UR = new UptimeRobot("");
$UR->setFormat('json');
$UR->setApiKey("YOUR-API-KEY-HERE");
try {
$params = array(
'name' => 'Google',
'uri' => 'http://www.google.com/',
'type' => 1
);
$result = $UR->newMonitor($params);
print_r($result);
}
catch (Exception $ex) {
switch ($ex->getCode()) {
case 1:
echo $ex->getMessage();
break;
case 2:
echo "You should try specifying an apiKey for once!";
break;
case 3:
echo "You forgot a required key, you moron!";
break;
default:
echo $ex->getCode(). ": ". $ex->getMessage();
}
}