Retrieves the filesize of a remote file. I can't take the credit for this function. I grabbed it somewhere online a few years back. Don't remember where.
- function remote_filesize($url, $user = "", $pw = "")
- $ch = curl_init($url);
- curl_setopt($ch, CURLOPT_HEADER, 1);
- curl_setopt($ch, CURLOPT_NOBODY, 1);
- curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
- $ok = curl_exec($ch);
- $head = ob_get_contents();
- $regex = '/Content-Length:\s([0-9].+?)\s/';
- $count = preg_match($regex, $head, $matches);
- return isset($matches) ? $matches : "unknown";
CommentsSubscribe to comments
You need to login to post a comment.