Reputation: 2405
Is it possible to get the md5 of a file on a remote server? If so how?
Upvotes: 4
Views: 15476
Reputation: 340201
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.
Upvotes: 10
Reputation: 816364
Well depends what you mean. There are two ways:
You connect to the remote server and calculate the hash there (like ssh to the server).
Get (download) the file and compute the hash.
Obviously to calculate the hash of a file you have to read the contents of the file.
Upvotes: 3