I looked at the PHP docs for fsockopen and whatnot, and they say that you cannot use filesize () in the remote file without doing some crazy things with ftell or something (not sure what they said for sure), but I had a good thought on how to do this:
$file = file_get_contents("http://www.google.com");
$filesize = mb_strlen($file) / 1000; //KBs, mb_* in case file contains unicode
Would this be a good method? It was so simple and useful to use at that time, I just want to get any thoughts if this might run into problems or not be the true file size.
I want to use this only by text (websites), not binary.
source
share