Is there a way to get the size of a remote file http://my_url/my_file.txt without downloading the file?
Most answers here uses either CURL or are basing on reading headers. But in some certain situations you can use a way easier solution. Consider note on filesize()'s docs on PHP.net. You'll find there a tip saying: "As of PHP 5.0.0, this function can also be used with some URL wrappers. Refer to Supported Protocols and Wrappers to determine which wrappers support stat() family of functionality".
So, if your server and PHP parser is properly configured, you can simply use filesize()
function, fed it with full URL, pointing to a remote file, which size you want to get, and let PHP do the all magic.