我使用file_get_html()
來獲取一些外部HTML,但我有一個問題。我似乎無法在div中定位文本,同時避免獲取其餘內容。file_get_html()獲取div內的純文本,但避免所有其他標記
讓說的佈局是這樣的:
<div class="post">
<h1>Andromeda v1.4 – WordPress – The Beauty of Simplicity</h1>
<div class="infos b20">
<img class="post_img" src="/imagini/512b93babf84b.jpg" alt="Andromeda v1.4 – WordPress – The Beauty of Simplicity">
<div style="width:610px; margin:10px 0; overflow:hidden; display:block;">
enter code here
Andromeda is a clean theme with functional CMS and unique features. A massive pack of backend CMS options was created for this product to give you full control while creating and editing the site and its features. The main idea behind this theme was to create a something clean and simple, useful, nice looking and easy to modify.
<p></p>
<h6>Demo</h6>
<code>http://themeforest.net/item/andromeda-wordpress-the-beauty-of-simplicity/107876</code>
<h6>Download:</h6>
<div class="link alert clearfix">
<div class="link alert clearfix">
<div class="link alert clearfix">
<div class="link alert clearfix">
<div class="link alert clearfix">
<div class="link alert clearfix">
<p></p>
<ul id="social_post" class="clearfix sharingbtns">
<div class="comments">
</div>
如果我做了
我得到的所有的內容,我只想文本,與類崗位主要DIV中,而不是所有其他內容。
達到此目的的最佳方法是什麼?
其他div的文本和數量是可變的,但div類的帖子和文本將始終在相同的位置。
編輯:爲了闡述,我只希望內部發布文字多數民衆贊成,且沒有標籤