set_time_limit(1000);
$handle2 = fopen("iibig.txt", "w+");
$s = '';
$file = new SplFileObject('ibig.txt');
while (false !== ($char = $file->fgetc())) {
if ( ord($char)>31 && ord($char) < 127) {
fwrite($handle2, $char);
$s = '';
} else {
if ($s=='') {
fwrite($handle2, " ");
$s = ' ';
}
}
}
fclose($handle2);
?>
A poniżej jak z wyniku wyciągnąć URL'e:
<?php
$h = file_get_contents('aaiibig.txt');
echo strlen($h);
preg_match_all('#\bhttps?://[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/))#', $h, $match);
$all_urls = $match[0];
for ($i=0; $i
echo $all_urls[$i]."\r\n";
}
?>