Codice PHP:
<?php

$file 
file_get_contents('./prova.txt'FILE_USE_INCLUDE_PATH);
$array explode("\n"$file);

foreach( 
$array as $var_temporanea ) {
    if(!empty(
$var_temporanea)){

        
$ch curl_init();
        
$user_agent "Mozilla/4.0 (compatible; MSIE 5.01; ".
                          
"Windows NT 5.0)";
        
$ch curl_init();
        
curl_setopt$chCURLOPT_USERAGENT$user_agent);
        
curl_setopt$chCURLOPT_HTTPGET);
        
curl_setopt$chCURLOPT_RETURNTRANSFER);
        
curl_setopt$chCURLOPT_FOLLOWLOCATION );
        
curl_setopt$chCURLOPT_FOLLOWLOCATION );
        
curl_setopt$chCURLOPT_URLtrim($var_temporanea) );
        
curl_setopt$chCURLOPT_REFERER$ref );
        
curl_setopt ($chCURLOPT_COOKIEJAR'cookie.txt');
        
$homepage curl_exec($ch);
        
curl_close($ch); 

        if(!
strpos($homepage,'TESTO')){
            echo 
"Non trovato.
"
;
            
file_put_contents("nontrovato.txt"$var_temporanea."\n"FILE_APPEND);

        }else{
            echo 
"Trovato!
"
;
            
file_put_contents("trovato.txt"$var_temporanea."\n"FILE_APPEND);
        } 
    }
}

?>
EDIT: testato anche su wikipedia e funziona