お世話になります。
現在、PHP Simple HTML DOM Parserを使って
html取得しているのですが
以下のタグを取得する場合どのようにすればよいでしょうか
html
1<div class="col_3_center"> 2 <ul class="main_entry_list"> 3 <li class="main_entry_item no_image lower_item"> 4 <div class="main_entry_text"> 5 <h3 class="main_entry_title"> 6 <a href="http://shirotabi413.blog46.fc2.com/blog-entry-2636.html" target="_blank" class="gtm-entry_link"> 7 内火艇とか作る 8 </a> 9 </h3> 10 <div class="main_entry_sup"> 11 <p class="main_entry_blog_name"> 12 <a href="http://shirotabi413.blog46.fc2.com/" target="_blank" class="gtm-blog_link"> 13 シロタビのひつまぶし 14 <span>19:28</span> 15 </a> 16 </p> 17 </div> 18 </div> 19 </li> 20 <li class="main_entry_item no_image lower_item"> 21 <div class="main_entry_text"> 22 <h3 class="main_entry_title"> 23 <a href="http://satoshichiharu.blog24.fc2.com/blog-entry-1535.html" target="_blank" class="gtm-entry_link"> 24 始動してます 25 </a> 26 </h3> 27 <div class="main_entry_sup"> 28 <p class="main_entry_blog_name"> 29 <a href="http://satoshichiharu.blog24.fc2.com/" target="_blank" class="gtm-blog_link"> 30 僕らのu !!! 31 <span>19:27</span> 32 </a> 33 </p> 34 </div> 35 </div> 36 </li>
上のhtmlから シロタビのひつまぶし 僕らのu !!!
を取得したいのですが分かりません
途中までのコード↓
php
1<?php 2require_once 'simple_html_dom.php'; 3$html = file_get_html( 'http://blog.fc2.com/newentry.html' ); 4$rss_url = "http://blog.fc2.com/newentry.html"; 5echo $html->find( 'h4', 3 ); 6 7 8 9 foreach( $html->find( 'main_entry_blog_name' ) as $li ) 10 { 11 echo $li->outertext; 12 } 13 foreach( $html->find( 'h3' ) as $li ) 14 { 15 echo $li->outertext; 16 } 17$html->clear(); 18unset($html); 19?>
アドバイスお願いします
回答1件
あなたの回答
tips
プレビュー