
22.05.2007, 08:06
|
|
Новичок
Регистрация: 06.10.2006
Сообщений: 11
Провел на форуме: 22670
Репутация:
5
|
|
PHP код:
<?php
error_reporting(0);
$file = '2.exe';
$url = 'example.ru';
$dir = '/';
if (ereg("(404)", Get_contints($url, $dir.$file))) die('remote file not found');
$md5 = md5_file('http://'.$url.$dir.$file);
if (!is_file($file)) die('local file not found');
if (md5_file($file) == $md5) echo 'Ok'; else echo 'Fufel';
function Get_contints($hosturl, $dir) {
$query = 'GET '.$dir.' HTTP/1.1'."\r\n".
'Host: '.$hosturl."\r\n".
'User-Agent: Mozilla/4.0 (MSIE 6.0; Windows NT 5.1)'."\r\n".
'Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5'."\r\n".
'Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7'."\r\n".
'Keep-Alive: 300'."\r\n".
'Connection: close'."\r\n".
'Cache-Control: max-age=0'."\r\n\r\n";
if ($socket=fsockopen($hosturl, 80, $errno, $errstr, 10)) {
fwrite($socket, $query);
//while (!feof($socket)) $result .= fgets($socket); //-- FULL
$result = fgets($socket);
fclose($socket);
}
return $result;
}
?>
Последний раз редактировалось j0ze; 22.05.2007 в 13:29..
|
|
|