Jump to content

preg_match_all -> anchor innerHTML help


Jnerocorp

Recommended Posts

Hello,

 

i am trying to pull the innerHTML out of this:

 

<a href="(.*?)">(.*?)</a> 

 

here is what I have:

 

<?php

$html = file_get_contents("http://www.businessinvestingsource.com/blcheck2.html");
preg_match_all('/<a href="(.*?)">(.*?)<\/a>/', $html, $links, PREG_SET_ORDER);

foreach ($links as $link) {
    $linkto = $link[1];
$anchor = $link[0];

echo "<b>Link:</b> ".$linkto."<br /><b>Anchor:</b> ".$anchor."<br /><br /> ";
}

?>

 

Now this code works but the innerHTML is coming out as a link I want it to come out as plaintext you can view here: http://businessinvestingsource.com/anchorcheck2.php

 

Can anyone help? :)

 

Thank you.

Link to comment
https://forums.phpfreaks.com/topic/246764-preg_match_all-anchor-innerhtml-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.