I'm trying to extract specific numbers using "PHP Scriptable Web Browser". So far I managed to extract string information that would be the usual thing one gets when doing a "view source" on Browser. Here's my code:
<?php
error_reporting(-1);
ini_set('display_errors', 'On');
header('Content-type: text/html; charset=utf-8');
require_once('simpletest/browser.php');
$browser = &new SimpleBrowser();
$browser->get('https://www.betfair.com/exchange/plus/football/');
$content[] = $browser->getContent();
preg_match("/<title>(.*)/", $content[0], $matches);
print $matches[1];
?>
I deployed this on my server and it returns the expected string.
The problem is that I don't know how to get the numbers I want, which in this case, are the odds of the games.
Using Chrome and developer tools I see the json information and there I see all those numbers. Looking around, I see that one way to get the JSON would be something like:
$json = file_get_contents('https://www.betfair.com/exchange/plus/football/');
But I couldn't make PHP Scriptable Web Browser to use this.
I know that people use "Beautifulsoup" for this kind of job, but I cannot use python/django and it has to be in PHP or Java.
Than I need to loop through all pages (https://www.betfair.com/exchange/plus/football/page/N) where N is not known in advance... and be able to store the numbers as variables and "print" them on Browser.
I apologize if this is confuse/open-ended/unclear. I know very littler about PHP, scrapping etc, so ANY help is s big help.
Thanks.