簡體   English   中英

使用 file_get_contents () 從 url 中抓取數據

[英]scrape data from a url with file_get_contents ()

我正在嘗試使用file_get_contents()讀取 URL。 我只需要從頁面中獲取$invoice

$invoice出現在句子中,如下例所示為數字 789621 : paid 789621

我怎么辦?

您需要一個simple_html_dom來從頁面上抓取發票。 然后使用

$ret = $html->find('div[id]');

檢索包含發票的 div。

$content=$ret->innertext;

給出那個 div 的內容。 休息很簡單。 只需將 $content 與 ' '(space) 分開並獲取您的 $invoice

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM