0o0o0 Posted September 14, 2015 Share Posted September 14, 2015 Did this a long time ago, and forget hoe to do it today.. searched the net for an hour no answers.. In simple php dom parser I need the coding for getting the element or tags name.. <div class="at_result" source="1215" category="24980966"> like category ... I need 24980966 <--- need that number..tried $item['ID'] = $article->find('category')->innertext; tried $item['ID'] = $article->find('category')->outertext; tried $item['ID'] = $article->find('category')->plaintext; tried $item['ID'] = $article->find('div.category')->plaintext; I forget whats needed. so it will parse out the "24980966" for me. anyone? next page could be <div class="at_result" source="1215" category="34382966"> etc etc.. thanks Quote Link to comment Share on other sites More sharing options...
Barand Posted September 14, 2015 Share Posted September 14, 2015 (edited) try $h = str_get_html($html); $res = $h->find("div.at_result[source=1215]"); foreach ($res as $r) { echo $r->category.'<br>'; } http://simplehtmldom.sourceforge.net/manual.htm Edited September 14, 2015 by Barand Quote Link to comment Share on other sites More sharing options...
0o0o0 Posted September 14, 2015 Author Share Posted September 14, 2015 I had it right 3 hours ago... duh.. It was OUTSIDE the foreach limit on the page.... maaaaan anyhow thanks for the reply. Quote Link to comment 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.