-
January 31st, 2015, 18:57
#1
عضو انجمن
کار با api
بسم الله الرحمن الرحیم
سلام
من چند وقتیه ک سایت رو داخل این سایت : https://uptimerobot.com/ ست کردم! و حالا بعد از گذشت چند وقت آپتایم کاملا مشخص شده! و می خوام ک آپتایم رو به نمایش بزارم! (به صورت زنده)
خودشون نوشتن ک از طریق api ممکنه!
https://uptimerobot.com/api
می خواستم بدونم روش نوشتنش چ جوریه؟
حقیقتش اصلا با api کار نکردم!
ممنون می شم ک کمک کنید
تلفن : 02191300401 ، تهران - صادقیه - بلوارفردوس شرق - پلاک 68 - واحد 18
پیشروتک |
ناحیه کاربری
-
-
January 31st, 2015 18:57
# ADS
-
January 31st, 2015, 23:27
#2
عضو انجمن
پاسخ : کار با api
خودشون که کامل توضیح دادند !
اینم نمونه کدش :
کد:
<?php
/*Note: You'll need the ID of the monitor. For that, simply go to "http://api.uptimerobot.com/getMonitors?apiKey=yourApiKey" and get the ID of the monitor to be queried.*/
/*And, this code requires PHP 5+ or PHP 4 with SimpleXML enabled.*/
/*Variables - Start*/
$apiKey = "yourApiKey"; /*replace with your apiKey*/
$monitorID = 1111111; /*replace with your monitorID*/
$url = "http://api.uptimerobot.com/getMonitors?apiKey=" . $apiKey . "&monitors=" . $monitorID . "&format=xml";
/*Variables - End*/
/*Curl Request - Start*/
$c = curl_init($url);
curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
$respon***ML = curl_exec($c);
curl_close($c);
/*Curl Request - End*/
/*XML Parsing - Start*/
$xml = simplexml_load_string($respon***ML);
foreach($xml->monitor as $monitor) {
echo $monitor['alltimeuptimeratio'];
}
/*XML Parsing - End*/
?>
-