Jnerocorp Posted September 9, 2011 Share Posted September 9, 2011 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 More sharing options...
voip03 Posted September 9, 2011 Share Posted September 9, 2011 file_get_contents()-read the contents of a file into a string EXPLAIN output for your query? Link to comment https://forums.phpfreaks.com/topic/246764-preg_match_all-anchor-innerhtml-help/#findComment-1267242 Share on other sites More sharing options...
Jnerocorp Posted September 9, 2011 Author Share Posted September 9, 2011 I know what file_get_contents does, and I already got it working look at the link I provided, I want the output to be plaintext intead it is pulling out a link with the preg_match_all for $link[1] Link to comment https://forums.phpfreaks.com/topic/246764-preg_match_all-anchor-innerhtml-help/#findComment-1267243 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.