Use filegetcontents() to read the file into a string. Use explode() to get the contents of the file/string into an array (since they're just single items, right?). Loop through the array to remove what you wanted to remove. Output the array (using implode()) back to the file.
<? set_time_limit(0); include('func.php'); $proxy = file_get_contents(realpath(dirname(__FILE__)).'/proxy.txt'); if (@$proxy != false) { $prox = explode("\n", $proxy); $p=0; foreach ($prox as $key => $value) { if (true == fast_check_proxy($value)) { $data[$p] = $value; $p++; } } $da = array_unique($data); if (@$da != false) { if (is_writable(realpath(dirname(__FILE__))).'/proxy.txt') { $handle = fopen((realpath(dirname(__FILE__))).'/proxy.txt', 'a'); ftruncate($handle, 0); foreach ($da as $key => $value) { if ($value != false) fwrite($handle, $value."\n"); } fclose($handle); } } } ?>