[php]
remove_filter(‘the_content’, ‘wpautop’);
[/php]
[php]
$type = $_REQUEST[‘t’];
if($type == 1) {
$url = $_POST[‘url’];
echo “URL = ” . $url . “
“;
//$url = ‘https://www.danny.com.br/’;
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
$subject = curl_exec($curl);
//get the download size of page
print(”
Download size: ” . curl_getinfo($curl, CURLINFO_SIZE_DOWNLOAD) .’
‘);
preg_match_all(‘/(?:src=)”([^”]*)”/m’, $subject, $matchessrc);
preg_match_all(‘/link.*\s*(?:href=)”([^”]*)”/m’, $subject, $matcheslink);
$matches = array_merge($matchessrc[1], $matcheslink[1]);
$domain = parse_url($url, PHP_URL_SCHEME). ‘://’.parse_url($url, PHP_URL_HOST);
$path = parse_url($url, PHP_URL_PATH);
$checked = array();
foreach($matches as $m)
{
if($m[0] == ‘/’)
$m = $domain.$m;
elseif(substr($m, 0, 5) != ‘http:’ and substr($m, 0, 6) != ‘https:’)
$m = $domain.’/’.$path.’/’.$m;
if(in_array($m, $checked))
continue;
$checked[] = $m;
$curl = curl_init($m);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
$subject = curl_exec($curl);
//get the download size of element
print(”
Download size: ” . curl_getinfo($curl, CURLINFO_SIZE_DOWNLOAD) .’
‘);
}
}
[/php]