
January 31st, 2000, 10:12 AM
|
|
Contributing User
|
|
Join Date: Oct 1999
Location: Annapolis, Maryland US
Posts: 113
Time spent in forums: < 1 sec
Reputation Power: 14
|
|
|
This is kind of a kludge, but it should point you in the right direction
<?
$html="<HTML><BODY><P><A HREF="url1">first link</A><P><A HREF="url2">second
link</A></BODY></HTML>";
$firstlist=split("<[/]?a|A[>]?", $html);
// find out which indexes contain "HREF" or "href"
// if it does, prepend "<A " and append "</A>" to it and put in new array
for($i=0; $i<count($firstlist); $i++)
{
if(eregi("HREF", $firstlist[$i]))
$secondlist[]="<A ".$firstlist[$i]."</A>";
}
// $secondlist array should contain all the links
for($i=0; $i<count($secondlist); $i++)
print"$secondlist[$i]<br>";
?>
|