PHP HTML DOM PARSER-span类ID

时间:2015-07-21 04:23:47

标签: php simple-html-dom

我正在使用PHP并使用HTML DOM PARSER ...并尝试检索...“STORE FRONT 9TERF” 我该如何做到这一点?

<span class "id="yui_3_18_1_1_1437448946157_8369">"STORE FRONT 9TERF"<span class="value-suffix"></span></span>


include('simple_html_dom.php');
$html = new simple_html_dom();
$html->load_file("URL");

 foreach($html->find('span [id=yui_3_18_1_1_1437448000304_8422]') as $data){
    echo "Info: ";    echo $data->innertext; 

   }
//echo $html->save();

1 个答案:

答案 0 :(得分:0)

试试这样:

$html->find('span#yui_3_18_1_1_1437448000304_8422')

更多examples