In order to extract the required data from the complete page, you need to create a small function that will scrape data from between two strings, such as tags.
public function scrape_between($data, $start, $end)
$data = stristr($data, $start);
$data = substr($data, strlen($start));
$stop = stripos($data, $end);
$data = substr($data, 0, $stop);
First, define the scraping function as scrape_between(), which takes the parameters $data (string, the source you want to scrape from), $start (string, at which point you wish to scrape from), $end (string, at which point you wish to finish scraping).
stristr() is used to strip all data from before the $start position. substr() is used to strip the $start from the beginning of the data. The $data variable now holds the data we want scraped, along with the trailing data from the input string.
stripos() is used to get the position of the $end of the data we want scraped, Then substr() is used to get what we wanted scraped in the $data variable. Finally, the data we wanted scraped, in $data, is returned from the function.