Spotter-VM/zz-extra/vm-ping.php

20 lines
461 B
PHP
Raw Normal View History

2018-09-02 18:16:48 +02:00
<?php
$url = (string)filter_input(INPUT_POST, 'url');
if (empty($url)) {
exit;
}
if(substr($url, -1) == '/') {
$url = substr($url, 0, -1);
}
2018-09-03 17:24:48 +02:00
$url .= '/vm-ping';
2018-09-02 18:16:48 +02:00
$ch = curl_init($url);
curl_setopt_array($ch, [CURLOPT_RETURNTRANSFER => TRUE, CURLOPT_HEADER => FALSE, CURLOPT_SSL_VERIFYHOST => FALSE, CURLOPT_SSL_VERIFYPEER => FALSE, CURLOPT_TIMEOUT => 4]);
$content = curl_exec($ch);
curl_close($ch);
2018-09-03 17:24:48 +02:00
if ($content == 'vm-pong') {
echo 'vm-pong';
2018-09-02 18:16:48 +02:00
}