I want to get the size of a remote file. And it can be done via this code:
$headers = get_headers("http://addressoffile", 1);
$filesize= $headers["Content-Length"];
But i do not know the file address directly. But i have a address which redirects to the original file.
For example: I have address http://somedomain.com/files/34
When i put this address into url bar of browser or use function file_get_contents('myfile.pdf',"http://somedomain.com/files/34");
, it starts downloading the original file.
And if i use above functions for calculating size of file then using the address http://somedomain.com/files/34
it return size 0.
Is there any way to get the address where the http://somedomain.com/files/34
redirects .
Or any other solution for calculating the size of the redirected file(original file).