phoenixx Posted August 23, 2008 Share Posted August 23, 2008 I've done this a hundred times so not sure why it's not working now.... Here's an example of the line in another website I'm targeting: <span class="bull1">• </span><a class="menu-sub-level" title="Dark Chocolate" href="http://www.furniturexo.com/advanced_search_result.php?keywords=&categories_id=&inc_subcat=1&manufacturers_id=32&group_id=&type_id=&style_id=&collection=Dark+Chocolate&pfrom=&dfrom=&dto=&x=0&y=0">Dark Chocolate</a> I only Need to extract the actual URL and Text between the anchor... In this case Dark Chocolate Here's the code I'm using. $data = @file_get_contents("http://www.0000000.com/XXXXXXX.html"); ; preg_match_all('/y=0".*?><"([^"]*)".*?a>"([^"]*)"/is',$data,$out); $d = array_combine($out[1], $out[2]); foreach($d as $k=>$v){ echo $v . "<br>"; } Thanks in advance for the help. I must need sleep... It's been a long 2 day session. Quote Link to comment https://forums.phpfreaks.com/topic/121037-solved-easy-preg_match_all-question-i-must-need-sleep/ Share on other sites More sharing options...
phoenixx Posted August 24, 2008 Author Share Posted August 24, 2008 Okay, so not much help from the forums, but I solved it. Quote Link to comment https://forums.phpfreaks.com/topic/121037-solved-easy-preg_match_all-question-i-must-need-sleep/#findComment-624018 Share on other sites More sharing options...
JasonLewis Posted August 24, 2008 Share Posted August 24, 2008 Good for you, next time you could post it in the correct section. And remember, no one likes a regex problem. Quote Link to comment https://forums.phpfreaks.com/topic/121037-solved-easy-preg_match_all-question-i-must-need-sleep/#findComment-624059 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.