简体   繁体   中英

php script that gives md5 of a online file

hi i'm looking for a script that gives me the md5 of a file by link i have all ready a script that gives the md5 of the files that are in the folder but now i wanna add a script where you paste the link to the file and it prints out the md5 if some one knows how to make this plz let me know

code that i have :

<?php
$cwd = $_SERVER['REQUEST_URI'];
$cwd = substr($cwd, 0, strrpos($cwd, '/' + 1));

function paintUndersideOfFox($c) {
global $cwd;
echo('<ul class="dirlist">');
$d = opendir($c);
while($f = readdir($d)) {
  if(strpos($f, '.') === 0) continue;
  $ff = $c . '/' . $f;
  echo 'MD5 file hash of ' . $ff . ': ' . md5_file($ff);
  echo('<li><a href="' . $cwd . $ff . '">' . $ff . '</a></li><br />');
  if(is_dir($ff)) paintUndersideOfFox($ff);
 }
 echo('</ul>');
}

paintUndersideOfFox('.');
?>

Most filesystem functions apply to streams, including HTTP. Did you try this

md5_file("http://remotelocation/file")

可以通过file_get_contents()或更安全地使用CURL完成文件下载

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM