Нужен скрипт обработки ссылок. Есть ссылка вида: <a href="javascript:if(confirm('http://teensexmania.com/jump.php?account=12 \n\nThis file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address. \n\nDo you want to open it from the server?'))window.location='http://teensexmania.com/jump.php?account=12'" tppabs="http://teensexmania.com/jump.php?account=12"><IMG height=193 alt="Teen Sex Movs" src="tsm2.jpg" tppabs="http://teenmegaworld.com/index_files/tsm2.jpg" width=218 border=0></a> Нужно получить: <a href="http://teenmegaworld.com/index_files/tsm2.jpg" width=218 border=0></a>
PHP: <?php $source =<<<EOF <a href="javascript:if(confirm('http://teensexmania.com/jump.php?account=12 \n\nThis file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address. \n\nDo you want to open it from the server?'))window.location='http://teensexmania.com/jump.php?account=12'" tppabs="http://teensexmania.com/jump.php?account=12"><IMG height=193 alt="Teen Sex Movs" src="tsm2.jpg" tppabs="http://teenmegaworld.com/index_files/tsm2.jpg" width=218 border=0></a> EOF; $start = strpos($source, 'jpg" tppabs=') + 12; $prom = substr($source, $start); $finish = '<a href='.$prom; echo $finish; ?> Без регулярных выражений, возможно, не очень красиво... но задачу поставленную выполняет
Не. Не то... Я напісал образно =) Есть хтмл файл с ссылками такого вида. Их нужно сделать вида как я указал
PHP: <?php $text =<<<HTML <a href="javascript:if(confirm('http://teensexmania.com/jump.php?account=12 \n\nThis file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address. \n\nDo you want to open it from the server?'))window.location='http://teensexmania.com/jump.php?account=12'" tppabs="http://teensexmania.com/jump.php?account=12"><IMG height=193 alt="Teen Sex Movs" src="tsm2.jpg" tppabs="http://teenmegaworld.com/index_files/tsm2.jpg" width=218 border=0></a> HTML; preg_match('|<IMG (.*?) tppabs=(.*?)border=0|', $text, $mas); echo '<a href=' . $mas[2] . ' border=0>link</a>'; ?>
PHP: <?php $text = '<a href="javascript:if(confirm("http://teensexmania.com/jump.php?account=12 \n\nThis file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address. \n\nDo you want to open it from the server?"))window.location="http://teensexmania.com/jump.php?account=12" tppabs="http://teensexmania.com/jump.php?account=12"><IMG height=193 alt="Teen Sex Movs" src="tsm2.jpg" tppabs="http://teenmegaworld.com/index_files/tsm2.jpg" width=218 border=0></a>'; preg_match('|src=.* tppabs=(.*)</a>|', $text, $out); $ssylka = "<a href={$out[1]}</a>"; echo $ssylka; ?>
Это не тот скрипт! Этот преспособлен только для примера! А мне нужно через переменные. Тоесть ссылки разные, только структура одинаковая
PHP: <pre> <?php $text = ' <a href="javascript:if(confirm("http://teensexmania.com/jump.php?account=12 \n\nThis file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address. \n\nDo you want to open it from the server?"))window.location="http://teensexmania.com/jump.php?account=12" tppabs="http://teensexmania.com/jump.php?account=12"><IMG height=193 alt="Teen Sex Movs" src="tsm2.jpg" tppabs="http://teenmegaworld.com/index_files/tsm222222222222.jpg" width=218 border=0></a> <a href="javascript:if(confirm("http://teensexmania.com/jump.php?account=12 \n\nThis file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address. \n\nDo you want to open it from the server?"))window.location="http://teensexmania.com/jump.php?account=12" tppabs="http://teensexmania.com/jump.php?account=12"><IMG height=193 alt="Teen Sex Movs" src="tsm2.jpg" tppabs="http://teenmegaworld.com/index_files/tsm33333333333.jpg" width=218 border=0></a> '; preg_match_all('|src=.* tppabs=(.*)</a>|', $text, $out); for($i=0;$i<count($out);$i++){ $ssylka = "<a href={$out[1][$i]}</a>\n"; echo $ssylka; } ?> </pre> и смотри исходники страницы