Dr.Mezo
Dr.Mezo

Reputation: 869

scrape data from a url with file_get_contents ()

I am trying to read a URL with file_get_contents(). I need to get only $invoice from the page.

$invoice appears on sentence like the following example as a number 789621 : paid 789621

how could i do it ?

Upvotes: 0

Views: 879

Answers (1)

Vivek Maskara
Vivek Maskara

Reputation: 1092

you would need a simple_html_dom to scrape the invoice from the page. then use

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

to retrieve the div that contains the invoice.

$content=$ret->innertext;

gives the content of that div. rest is simple. just split the $content with ' '(space) and get your $invoice

Upvotes: 1

Related Questions