Disassembler
ce325cf3d0
- Bump basic OS to Alpine 3.9 - Restructure repo and add layer versioning - Use JSON for all metadata - Merge abuild branch (but without abuild)
24 lines
654 B
PHP
24 lines
654 B
PHP
<?php
|
|
// Extract URL from 'url' GET field
|
|
$url = (string)filter_input(INPUT_GET, 'url');
|
|
if (empty($url)) {
|
|
exit;
|
|
}
|
|
|
|
// Strip endpoint to scheme://host:port/vm-ping to prevent abuse
|
|
$url = parse_url($url);
|
|
if (!$url) {
|
|
exit;
|
|
}
|
|
$url = $url['scheme'].'://'.$url['host'].(!empty($url['port']) ? ':'.$url['port'] : '').'/vm-ping';
|
|
|
|
// Ping the remote endpoint
|
|
$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);
|
|
|
|
if ($content == 'vm-pong') {
|
|
echo 'vm-pong';
|
|
}
|