Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP - Get the md5 of remote file?

Tags:

php

md5

ftp

Is it possible to get the md5 of a file on a remote server? If so how?

like image 826
Mickey Avatar asked Nov 27 '22 23:11

Mickey


2 Answers

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

like image 60
newacct Avatar answered Dec 07 '22 23:12

newacct


It's not possible without downloading it, or the remote server providing the information (web service, HTML page, etc.)

You can use md5(file_get_contents("http://remotelocation/file")) to download the file and calculate the md5 hash if your PHP installation is configured to open remote streams. But that will download the complete file.

like image 41
Vinko Vrsalovic Avatar answered Dec 08 '22 00:12

Vinko Vrsalovic