0
我得刮一個網址,並得到一個項目的價格。 我正在嘗試簡單的PHP DOM,但有一些我做錯了。 這是代碼的一部分,其中價格是:用dd標記刮網址php
<div class="Right">
<dl class="Price Offer" itemprop="offers" itemscope itemtype="http://schema.org/Offer">
<dt>Price:</dt>
<dd itemprop="price">$49.99</dd>
<link itemprop="availability" href="http://schema.org/InStock" content="In Stock"/>
</dl>
<dl class="Identifier">
<dt>Prod ID:</dt>
<dd itemprop="productID">68947</dd>
</dl>
</div>
我需要得到$ 49.99,沒有別的,但我真的失去了。 我試過使用 - >明文,然後做一些爆炸或str_replace,但似乎我做錯了什麼。
This is the url i'm trying to scrape
謝謝!
是的,代碼? – dbf
$ html = file_get_html($ url) - > plaintext;從那裏開始,實現了剝離標籤的功能,但它不能在dd和dt標籤上工作..... –
K,請勿將它置於評論中,請將其放入您的帖子中。 – dbf