Проблема с линками

peshkov

Новичок
Проблема с линками

PHP:
$base=file("base.txt");
$cou=count($base);

$fp=fopen ("text.txt","w");

for ($x=0;$x<$cou;$x++)
{
print "$base[$x]<br>";
$tr =implode('',file($base[$x]));

$text= str_replace("\n",'',$tr);
$text= str_replace("<",'',$text);
$text= str_replace(">",'',$text);
$text= str_replace('"','',$text);
$text= str_replace("'",'',$text);
$text= str_replace(';','',$text);
$text= str_replace('=','',$text);

fwrite($fp,"$text\n");
}
/////////////////////////////////////////////////////////////

$f=file('text.txt');

$fo=fopen ("zapros.txt","w");

for ($x=0;$x<count($f);$x++)
{
if (preg_match("~TrackBack URL for this Entry:(.{0,300})~i","$f[$x]",$matches)) 
{
 $text= str_replace('TrackBack URL for this Entry:','',$matches[0]);
 $text= str_replace("!\s+!",'',$text);

 preg_match("~[url]http://[/url][^ ]*\/(\d{1,5})~i","$text",$mat);

fwrite($fo,"$mat[0]\n");
print "<br>$mat[0]";
}
	 else
  			{
			}
		}


?>
вот скрипт
base.txt
http://golem.ph.utexas.edu/string/archives/000578.html
http://www.completesquare.org/mt/mt-tb.cgi?__mode=view&entry_id=97
http://www.completesquare.org/mt/mt-tb.cgi?__mode=view&entry_id=96
http://www.completesquare.org/mt/mt-tb.cgi?__mode=view&entry_id=95
http://www.completesquare.org/mt/mt-tb.cgi?__mode=view&entry_id=94
http://www.transterrestrial.com/archives/006873.html
http://www.windsofchange.net/archives/004824.php

в фаиле zapros.txt запрос отсутствует

http://www.transterrestrial.com/archives/006873.html


zapros.txt
http://www.completesquare.org/mt/mt-tb.cgi/97
http://www.completesquare.org/mt/mt-tb.cgi/96
http://www.completesquare.org/mt/mt-tb.cgi/95
http://www.completesquare.org/mt/mt-tb.cgi/94
http://www.windsofchange.net/windsopcentre-cms/trackback.cgi/2578

проблема в том что он вытягивает не все линки
 

Acabar

Новичок
мне не понятно, как он вообще работает?
PHP:
if (preg_match("~TrackBack URL for this Entry<img src="images/smilies/frown.gif" border="0" alt="">.{0,300})~i","$f[$x]",$matches))
Тут синтаксическая ошибка.
 

peshkov

Новичок
PHP:
if (preg_match("~TrackBack URL for this Entry:(.{0,300})~i","$f[$x]",$matches)) 
{
 $text= str_replace('TrackBack URL for this Entry:','',$matches[0]);
 $text= str_replace("!\s+!",'',$text);
 
Сверху