PHP Code:
<?php
function jsonp_decode($jsonp, $assoc = false) {
if($jsonp[0] !== '[' && $jsonp[0] !== '{') {
$jsonp = substr($jsonp, strpos($jsonp, '('));
}
return json_decode(trim($jsonp,'();'), $assoc);
}
$data = file_get_contents("https://ws.ovh.com/dedicated/r2/ws.dispatcher/getAvailability2?callback=Request.JSONP.request_map.request_0");
$data = jsonp_decode($data, true);
foreach($data["answer"]["availability"] as $key => $value) {
if($value["reference"] == "142sk1") { //SK1 = KS1 (6€ Root)
$available = false;
foreach($value["zones"] as $key => $value) {
if($value["availability"] != "unavailable") {
$available = true;
}
}
if($available) {
// hier hatte ich eine Benachrichtigung auf mein Handy per pushOver
}
}
}
?>