I am having problems with my script below. What I want to do essentially. is to grab "<a href>" links and tags and then be able to manipulate them by array variables. I am planning to only echo to screen these tags that exist on a site or page. How do I take what I have below and make it able to do this?
I appreciate the help!
Code:
$url="[URL unfurl="true"]http://www.mywebsite.com";[/URL]
function return_a($url) {
$array = file ($url);
for ($i = 0; $i < count($array); $i++)
{
if (preg_match("/<a(.*)href(.*)>(.*)<\/a>/i",$array[$i], $tag_contents)) {
$atag = array();
$atag = $tag_contents[$i];
$atag = strip_tags($atag);
}
}
return print_r($array);
}
I appreciate the help!