вопрос
Привет всем, есть парсер гороскопа с http://horo.mail.ru/
Скрипт справляется с этой задачей нормально, но в тексте mail делает ссылки, и вот эти ссылки у меня то же парсяться.
Кто может подсказать что внести в код что бы ссылки удалялись, только ссылки НЕ со словами.
И + в конце дописывается ещё
© Lady.mail.ru, эксклюзивный прогноз
Можно ли всё это удалить?
Скрипт справляется с этой задачей нормально, но в тексте mail делает ссылки, и вот эти ссылки у меня то же парсяться.
Кто может подсказать что внести в код что бы ссылки удалялись, только ссылки НЕ со словами.
<?
/*
Horoscope module by Nitro
http://www.nisoft.ru
Малюсенькую капельку (исправление бага, когда полностью не отображался гороскоп на сегодня и на вчера) внёс BoxsteR
*/
if(!defined('DATALIFEENGINE'))
{
die("Hacking attempt!");
}
############## Читаем кэш мать его... ################
function horos_cache($prefix, $cache_id=false){
global $config;
if ($config['allow_cache'] != "yes") return false;
if (!$cache_id) {
$filename = ENGINE_DIR.'/cache/'.$prefix.'.tmp';
} else {
$cache_id = totranslit ($cache_id);
$filename = ENGINE_DIR."/cache/".$prefix."_".$cache_id.".tmp";
}
return @file_get_contents($filename);
}
############## Кэшируем бля... ################
function addto_cache($prefix, $cache_text, $cache_id=false){
global $config;
if ($config['allow_cache'] != "yes") return false;
if (!$cache_id) {
$filename = ENGINE_DIR.'/cache/'.$prefix.'.tmp';
} else {
$cache_id = totranslit ($cache_id);
$filename = ENGINE_DIR."/cache/".$prefix."_".$cache_id.".tmp";
}
$fp = fopen($filename, 'wb+');
fwrite($fp, $cache_text);
fclose($fp);
@chmod($filename, 0666);
}
$tpl->load_template('horoscope.tpl');
$title = "Овен";
$pic = "<img src=\"{THEME}/images/zodiac/aries.gif\" marginwidth=\"5\">";
//$sign="aries";
$time = $_GET['time'];
$timerus = array(
'' => "Гороскоп на сегодня",
'yesterday' => "Вчерашний гороскоп",
'tomorrow' => "Гороскоп на завтра",
'week' => "Гороскоп на неделю",
'month' => "Гороскоп на месяц",
'year' => "Гороскоп на год",
);
switch ($_GET['sign']) {
case "aries" :
$act=1;
$pic = "<img src=\"{THEME}/images/zodiac/aries.gif\" marginwidth=\"5\">";
$title = "Овен";
$metatags['title'] = "".$title." > ".$timerus[$time] ." > ".$config['home_title']."";
break;
case "taurus":
$act=2;
$pic = "<img src=\"{THEME}/images/zodiac/taurus.gif\" marginwidth=\"5\">";
$title = "Телец";
$metatags['title'] = "".$title." > ".$timerus[$time] ." > ".$config['home_title']."";
break;
case "gemini" :
$act = 3; $pic = "<img src=\"{THEME}/images/zodiac/gemini.gif\" marginwidth=\"5\">";
$title = "Близнецы";
$metatags['title'] = "".$title." > ".$timerus[$time] ." > ".$config['home_title']."";
break;
case "cancer" :
$act = 4; $pic = "<img src=\"{THEME}/images/zodiac/cancer.gif\" marginwidth=\"5\">";
$title = "Рак";
$metatags['title'] = "".$title." > ".$timerus[$time] ." > ".$config['home_title']."";
break;
case "leo" :
$act = 5; $pic = "<img src=\"{THEME}/images/zodiac/leo.gif\" marginwidth=\"5\">";
$title = "Лев";
$metatags['title'] = "".$title." > ".$timerus[$time] ." > ".$config['home_title']."";
break;
case "virgo" :
$act = 6; $pic = "<img src=\"{THEME}/images/zodiac/virgo.gif\" marginwidth=\"5\">";
$title = "Дева";
$metatags['title'] = "".$title." > ".$timerus[$time] ." > ".$config['home_title']."";
break;
case "libra" :
$act = 7; $pic = "<img src=\"{THEME}/images/zodiac/libra.gif\" marginwidth=\"5\">";
$title = "Весы";
$metatags['title'] = "".$title." > ".$timerus[$time] ." > ".$config['home_title']."";
break;
case "scorpio" :
$act = 8; $pic = "<img src=\"{THEME}/images/zodiac/scorpio.gif\" marginwidth=\"5\">";
$title = "Скорпион";
$metatags['title'] = "".$title." > ".$timerus[$time] ." > ".$config['home_title']."";
break;
case "sagittarius" :
$act = 9; $pic = "<img src=\"{THEME}/images/zodiac/sagittarius.gif\" marginwidth=\"5\">";
$title = "Стрелец";
$metatags['title'] = "".$title." > ".$timerus[$time] ." > ".$config['home_title']."";
break;
case "capricorn" :
$act = 10; $pic = "<img src=\"{THEME}/images/zodiac/capricorn.gif\" marginwidth=\"5\">";
$title = "Козерог";
$metatags['title'] = "".$title." > ".$timerus[$time] ." > ".$config['home_title']."";
break;
case "aquarius" :
$act = 11; $pic = "<img src=\"{THEME}/images/zodiac/aquarius.gif\" marginwidth=\"5\">";
$title = "Водолей";
$metatags['title'] = "".$title." > ".$timerus[$time] ." > ".$config['home_title']."";
break;
case "pisces" :
$act = 12; $pic = "<img src=\"{THEME}/images/zodiac/pisces.gif\" marginwidth=\"5\">";
$title = "Рыбы";
$metatags['title'] = "".$title." > ".$timerus[$time] ." > ".$config['home_title']."";
break;
}
if ($_GET['sign'] == "")
{
$sign = "aries";
$metatags['title'] = "".$title." > ".$timerus[$time] ." > ".$config['home_title']."";
}
else {
$sign = $_GET['sign'];
}
$hor = horos_cache($sign, $time.date(now));
if (!$hor) {
$open = @file_get_contents("http://horo.mail.ru/prediction.html?sign=$act&time=$time", "r");
if ($time == 'year') {
preg_match_all('|<div id="tm_year">(.*)<script|Uis', $open, $elements);
}
if ($time == 'month')
{
preg_match_all('|<div id="tm_month">(.*)<script|Uis', $open, $elements);
}
elseif ($time == 'week')
{
preg_match_all('|<div id="tm_week">(.*)<a href|Uis', $open, $elements);
}
elseif ($time == 'yesterday')
{
preg_match_all('|<div id="tm_yesterday">(.*)<script|Uis', $open, $elements);
}
elseif ($time == 'tomorrow')
{
preg_match_all('|<div id="tm_tomorrow">(.*)<script|Uis', $open, $elements);
}
elseif ($time == '')
{
preg_match_all('|<div id="tm_today">(.*)?<script|Uis', $open, $elements);
}
foreach($elements[1] as $id=>$horoscope)
{
$hor .= $horoscope;
}
addto_cache($sign, $hor, $time.date(now));
}
if(isset($time) && $time != "")
{
if ($config['allow_alt_url'] == "yes")
{
$linkhor .= "<a href=\"/horoscope/$sign/\">Гороскоп на сегодня</a>";
}
else
{
$linkhor .= "<a href=\"/index.php?do=horoscope&sign=$sign\">Гороскоп на сегодня</a>";
}
}
else
{
if ($config['allow_alt_url'] == "yes")
{
$linkhor .= "<a href=\"/horoscope/$sign/yesterday.html\">< Вчерашний Гороскоп</a> | <a href=\"/horoscope/$sign/tomorrow.html\">Гороскоп на завтра </a> | <a href=\"/horoscope/$sign/week.html\">Гороскоп на неделю </a> | <a href=\"/horoscope/$sign/month.html\">Гороскоп на месяц </a> | <a href=\"/horoscope/$sign/year.html\">Гороскоп на год ></a>";
}
else
{
$linkhor .= "<a href=\"/index.php?do=horoscope&sign=$sign&time=yesterday\">< Вчерашний Гороскоп</a> | <a href=\"/index.php?do=horoscope&sign=$sign&time=tomorrow\">Гороскоп на завтра </a> | <a href=\"/index.php?do=horoscope&sign=$sign&time=week\">Гороскоп на неделю </a> | <a href=\"/index.php?do=horoscope&sign=$sign&time=month\">Гороскоп на месяц </a> | <a href=\"/index.php?do=horoscope&sign=$sign&time=year\">Гороскоп на год ></a> ";
}
}
if(!$hor)
{
$conhor .= "<br />Гороскопа в данный момент нету, зайдите попозже!";
}
if ($config['allow_alt_url'] == "yes")
{
$self_link = "<a href=\"/horoscope/\">Гороскоп</a>";
$blockhor .= '
<table width="100%" cellpadding="5" cellspacing="5" border="1" bordercolor="#cccccc" style="border-collapse: collapse;">
<tr align="center" class="news1">
<TD width="25%" style="padding:4px;">
<A title="Овен (21.03 - 20.04)" href="/horoscope/aries/"><IMG border="0" height="100" width="100" src="{THEME}/images/zodiac/aries.gif"></A><BR /><A title="Овен (21.03 - 20.04)" href="/horoscope/aries/">Овен</A>
<DIV>21.03 - 20.04</DIV>
</TD>
<TD width="25%" style="padding:4px;">
<A title="Телец (21.04 - 20.05)" href="/horoscope/taurus/"><IMG border="0" height="100" width="100" src="{THEME}/images/zodiac/taurus.gif"></A><BR /><A title="Телец (21.04 - 20.05)" href="/horoscope/taurus/">Телец</A>
<DIV>21.04 - 20.05</DIV>
</TD>
<TD width="25%" style="padding:4px;">
<A title="Близнецы (21.05 - 21.06)" href="/horoscope/gemini/"><IMG border="0" height="100" width="100" src="{THEME}/images/zodiac/gemini.gif"></A><BR /><A title="Близнецы (21.05 - 21.06)" href="/horoscope/gemini/">Близнецы</A>
<DIV>21.05 - 21.06</DIV>
</TD>
<TD width="25%" style="padding:4px;">
<A title="Рак (22.06 - 22.07)" href="/horoscope/cancer/"><IMG border="0" height="100" width="100" src="{THEME}/images/zodiac/cancer.gif"></A><BR /><A title="Рак (22.06 - 22.07)" href="/horoscope/cancer/">Рак</A>
<DIV>22.06 - 22.07</DIV>
</TD>
</tr>
<tr align="center" class="news1">
<TD width="25%" style="padding:4px;">
<A title="Лев (23.07 - 23.08)" href="/horoscope/leo/"><IMG border="0" height="100" width="100" src="{THEME}/images/zodiac/leo.gif"></A><BR /><A title="Лев (23.07 - 23.08)" href="/horoscope/leo/">Лев</A>
<DIV>23.07 - 23.08</DIV>
</TD>
<TD width="25%" style="padding:4px;">
<A title="Дева (24.08 - 23.09)" href="/horoscope/virgo/"><IMG border="0" height="100" width="100" src="{THEME}/images/zodiac/virgo.gif"></A><BR /><A title="Дева (24.08 - 23.09)" href="/horoscope/virgo/">Дева</A>
<DIV>24.08 - 23.09</DIV>
</TD>
<TD width="25%" style="padding:4px;">
<A title="Весы (24.09 - 23.10)" href="/horoscope/libra/"><IMG border="0" height="100" width="100" src="{THEME}/images/zodiac/libra.gif"></A><BR /><A title="Весы (24.09 - 23.10)" href="/horoscope/libra/">Весы</A>
<DIV>24.09 - 23.10</DIV>
</TD>
<TD width="25%" style="padding:4px;">
<A title="Скорпион (24.10 - 22.11)" href="/horoscope/scorpio/"><IMG border="0" height="100" width="100" src="{THEME}/images/zodiac/scorpio.gif"></A><BR /><A title="Скорпион (24.10 - 22.11)" href="/horoscope/scorpio/">Скорпион</A>
<DIV>24.10 - 22.11</DIV>
</TD>
</tr>
<tr align="center" class="news1">
<TD width="25%" style="padding:4px;">
<A title="Стрелец (23.11 - 21.12)" href="/horoscope/sagittarius/"><IMG border="0" height="100" width="100" src="{THEME}/images/zodiac/sagittarius.gif"></A><BR /><A title="Стрелец (23.11 - 21.12)" href="/horoscope/sagittarius/">Стрелец</A>
<DIV>23.11 - 21.12</DIV>
</TD>
<TD width="25%" style="padding:4px;">
<A title="Козерог (22.12 - 20.01)" href="/horoscope/capricorn/"><IMG border="0" height="100" width="100" src="{THEME}/images/zodiac/capricorn.gif"></A><BR /><A title="Козерог (22.12 - 20.01)" href="/horoscope/capricorn/">Козерог</A>
<DIV>22.12 - 20.01</DIV>
</TD>
<TD width="25%" style="padding:4px;">
<A title="Водолей (21.01 - 20.02)" href="/horoscope/aquarius/"><IMG border="0" height="100" width="100" src="{THEME}/images/zodiac/aquarius.gif"></A><BR /><A title="Водолей (21.01 - 20.02)" href="/horoscope/aquarius/">Водолей</A>
<DIV>21.01 - 20.02</DIV>
</TD>
<TD width="25%" style="padding:4px;">
<A title="Рыбы (21.02 - 20.03)" href="/horoscope/pisces/"><IMG border="0" height="100" width="100" src="{THEME}/images/zodiac/pisces.gif"></A><BR /><A title="Рыбы (21.02 - 20.03)" href="/horoscope/pisces/">Рыбы</A>
<DIV>21.02 - 20.03</DIV>
</TD>
</tr>
</table>';
}
else
{
$self_link = "<a href=\"/index.php?do=horoscope\">Гороскоп</a>";
$blockhor .= '
<table width="100%" cellpadding="5" cellspacing="5" border="1" bordercolor="#cccccc" style="border-collapse: collapse;">
<tr align="center" class="news1">
<TD width="25%" style="padding:4px;">
<A title="Овен (21.03 - 20.04)" href="/index.php?do=horoscope&sign=aries"><IMG border="0" height="100" width="100" src="{THEME}/images/zodiac/aries.gif"></A><BR /><A title="Овен (21.03 - 20.04)" href="/index.php?do=horoscope&sign=aries">Овен</A>
<DIV>21.03 - 20.04</DIV>
</TD>
<TD width="25%" style="padding:4px;">
<A title="Телец (21.04 - 20.05)" href="/index.php?do=horoscope&sign=taurus"><IMG border="0" height="100" width="100" src="{THEME}/images/zodiac/taurus.gif"></A><BR /><A title="Телец (21.04 - 20.05)" href="/index.php?do=horoscope&sign=taurus">Телец</A>
<DIV>21.04 - 20.05</DIV>
</TD>
<TD width="25%" style="padding:4px;">
<A title="Близнецы (21.05 - 21.06)" href="/index.php?do=horoscope&sign=gemini"><IMG border="0" height="100" width="100" src="{THEME}/images/zodiac/gemini.gif"></A><BR /><A title="Близнецы (21.05 - 21.06)" href="/index.php?do=horoscope&sign=gemini">Близнецы</A>
<DIV>21.05 - 21.06</DIV>
</TD>
<TD width="25%" style="padding:4px;">
<A title="Рак (22.06 - 22.07)" href="/index.php?do=horoscope&sign=cancer"><IMG border="0" height="100" width="100" src="{THEME}/images/zodiac/cancer.gif"></A><BR /><A title="Рак (22.06 - 22.07)" href="/index.php?do=horoscope&sign=cancer">Рак</A>
<DIV>22.06 - 22.07</DIV>
</TD>
</tr>
<tr align="center" class="news1">
<TD width="25%" style="padding:4px;">
<A title="Лев (23.07 - 23.08)" href="/index.php?do=horoscope&sign=leo"><IMG border="0" height="100" width="100" src="{THEME}/images/zodiac/leo.gif"></A><BR /><A title="Лев (23.07 - 23.08)" href="/index.php?do=horoscope&sign=leo">Лев</A>
<DIV>23.07 - 23.08</DIV>
</TD>
<TD width="25%" style="padding:4px;">
<A title="Дева (24.08 - 23.09)" href="/index.php?do=horoscope&sign=virgo"><IMG border="0" height="100" width="100" src="{THEME}/images/zodiac/virgo.gif"></A><BR /><A title="Дева (24.08 - 23.09)" href="/index.php?do=horoscope&sign=virgo">Дева</A>
<DIV>24.08 - 23.09</DIV>
</TD>
<TD width="25%" style="padding:4px;">
<A title="Весы (24.09 - 23.10)" href="/index.php?do=horoscope&sign=libra"><IMG border="0" height="100" width="100" src="{THEME}/images/zodiac/libra.gif"></A><BR /><A title="Весы (24.09 - 23.10)" href="/index.php?do=horoscope&sign=libra">Весы</A>
<DIV>24.09 - 23.10</DIV>
</TD>
<TD width="25%" style="padding:4px;">
<A title="Скорпион (24.10 - 22.11)" href="/index.php?do=horoscope&sign=scorpio"><IMG border="0" height="100" width="100" src="{THEME}/images/zodiac/scorpio.gif"></A><BR /><A title="Скорпион (24.10 - 22.11)" href="/index.php?do=horoscope&sign=scorpio">Скорпион</A>
<DIV>24.10 - 22.11</DIV>
</TD>
</tr>
<tr align="center" class="news1">
<TD width="25%" style="padding:4px;">
<A title="Стрелец (23.11 - 21.12)" href="/index.php?do=horoscope&sign=sagittarius"><IMG border="0" height="100" width="100" src="{THEME}/images/zodiac/sagittarius.gif"></A><BR /><A title="Стрелец (23.11 - 21.12)" href="/index.php?do=horoscope&sign=sagittarius">Стрелец</A>
<DIV>23.11 - 21.12</DIV>
</TD>
<TD width="25%" style="padding:4px;">
<A title="Козерог (22.12 - 20.01)" href="/index.php?do=horoscope&sign=capricorn"><IMG border="0" height="100" width="100" src="{THEME}/images/zodiac/capricorn.gif"></A><BR /><A title="Козерог (22.12 - 20.01)" href="/index.php?do=horoscope&sign=capricorn">Козерог</A>
<DIV>22.12 - 20.01</DIV>
</TD>
<TD width="25%" style="padding:4px;">
<A title="Водолей (21.01 - 20.02)" href="/index.php?do=horoscope&sign=aquarius"><IMG border="0" height="100" width="100" src="{THEME}/images/zodiac/aquarius.gif"></A><BR /><A title="Водолей (21.01 - 20.02)" href="/index.php?do=horoscope&sign=aquarius">Водолей</A>
<DIV>21.01 - 20.02</DIV>
</TD>
<TD width="25%" style="padding:4px;">
<A title="Рыбы (21.02 - 20.03)" href="/index.php?do=horoscope&sign=pisces"><IMG border="0" height="100" width="100" src="{THEME}/images/zodiac/pisces.gif"></A><BR /><A title="Рыбы (21.02 - 20.03)" href="/index.php?do=horoscope&sign=pisces">Рыбы</A>
<DIV>21.02 - 20.03</DIV>
</TD>
</tr>
</table>';
}
//echo $conhor;
$tpl->set('{timerus}',$timerus[$time]);
$tpl->set('{pic}',$pic);
$tpl->set('{zodiac}',$title);
$tpl->set('{blockhor}',$blockhor);
$tpl->set('{horoscope}',$hor);
$tpl->set('{links}',$linkhor);
$tpl->set('{self}',$self_link);
$tpl->compile('content');
$tpl->clear();
?>
И + в конце дописывается ещё
© Lady.mail.ru, эксклюзивный прогноз
Можно ли всё это удалить?