function drd_server_server_check_host in Drupal Remote Dashboard Server 7
Same name and namespace in other branches
- 6.2 drd_server.server.inc \drd_server_server_check_host()
- 6 drd_server.server.inc \drd_server_server_check_host()
- 7.2 drd_server.server.inc \drd_server_server_check_host()
1 call to drd_server_server_check_host()
File
- ./
drd_server.server.inc, line 29
Code
function drd_server_server_check_host($url, $dir) {
$id = rand();
$file = DRUPAL_ROOT . '/sites/' . $dir . '/files/drd_id.html';
try {
if (file_exists($file)) {
unlink($file);
}
$fp = fopen($file, 'w');
fwrite($fp, $id);
fclose($fp);
$context = stream_context_create(array(
'http' => array(
'timeout' => 1,
),
));
$check = file_get_contents('http://' . $url . '/sites/' . $dir . '/files/drd_id.html', FALSE, $context);
unlink($file);
return $check == $id;
} catch (Exception $e) {
return FALSE;
}
}