PHP ::
Get Remote Filesize
Source Code Snippet
function remote_filesize($url, $user = "", $pw = "")
{
ob_start();
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_NOBODY, 1);
if(!empty($user) && !empty($pw))
{
$headers = array('Authorization: Basic ' . base64_encode("$user:$pw"));
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
}
$ok = curl_exec($ch);
curl_close($ch);
$head = ob_get_contents();
ob_end_clean();
$regex = '/Content-Length:\s([0-9].+?)\s/';
$count = preg_match($regex, $head, $matches);
return isset($matches[1]) ? $matches[1] : "unknown";
}
Directory contents by Webmaster - 2012-01-29 18:47:21 (1 views) [preg_match]
Slice and dice an email address by Webmaster - 2012-01-29 18:47:03 (1 views) [email | function_exists | mail | split | strtolower | substr | time]
Provide rudimentary strongly typed arguments for functions by Webmaster - 2012-01-29 18:46:49 (2 views) [md5]
Multiple Input Buttons with only one form by Webmaster - 2012-01-29 18:41:57 (1 views)
Bad word filter by Webmaster - 2012-01-29 18:41:54 (2 views)
BBCode class by Webmaster - 2012-01-29 18:41:52 (2 views) [email | mail | preg_replace]
Detect IE (Internet Explorer) by Webmaster - 2012-01-29 18:41:45 (2 views)
Recursive directory delete by Webmaster - 2012-01-29 18:40:56 (1 views) [substr]
Show all pre-set $_SERVER variables by Webmaster - 2012-01-29 18:40:39 (2 views)
Counter with cookies by Webmaster - 2012-01-29 18:40:37 (2 views) [setcookie | time]
No comment yet.