get the content and href from <a> tags
Posted: Tue Nov 10, 2009 5:10 pm
Hi
I am doing some search result scarping. I have an extracted the text between <a> ....</a> using preg_match_all() and therfore it is an array which in turn contains one more <a> </a> tags . for eg. i have a array entry like this (this entry has only one <a> tag)
<a onclick="ntptEventTag('ev=serp_result_take&serp_link=/channel/skin-cancer.html&serp_term=cancer&serp_result_pos=1&serp_result_type=smartanswer&sa_contents_qty=4')" name="Skin Cancer" href="/channel/skin-cancer.html">Skin Cancer</a>
from this I want to extract href and content and put it into an associative array like
[href="/channel/skin-cancer.html]=> Skin Cancer
I am stuck how to do it . Please help
Mehnaz
I am doing some search result scarping. I have an extracted the text between <a> ....</a> using preg_match_all() and therfore it is an array which in turn contains one more <a> </a> tags . for eg. i have a array entry like this (this entry has only one <a> tag)
<a onclick="ntptEventTag('ev=serp_result_take&serp_link=/channel/skin-cancer.html&serp_term=cancer&serp_result_pos=1&serp_result_type=smartanswer&sa_contents_qty=4')" name="Skin Cancer" href="/channel/skin-cancer.html">Skin Cancer</a>
from this I want to extract href and content and put it into an associative array like
[href="/channel/skin-cancer.html]=> Skin Cancer
I am stuck how to do it . Please help
Mehnaz