Warning: include_once(normal-page.php): failed to open stream: No such file or directory in /var/www/vhosts/bglbuddy.com/api/sample-php.html on line 4

Warning: include_once(): Failed opening 'normal-page.php' for inclusion (include_path='/var/www/vhosts/bglbuddy.com.com/includes:./includes:/var/www/vhosts/PHPMailer:/usr/share/pear:/usr/bin/pear') in /var/www/vhosts/bglbuddy.com/api/sample-php.html on line 4
ManageBGL Sample API calls
Warning: include_once(header3.php): failed to open stream: No such file or directory in /var/www/vhosts/bglbuddy.com/api/sample-php.html on line 10

Warning: include_once(): Failed opening 'header3.php' for inclusion (include_path='/var/www/vhosts/bglbuddy.com.com/includes:./includes:/var/www/vhosts/PHPMailer:/usr/share/pear:/usr/bin/pear') in /var/www/vhosts/bglbuddy.com/api/sample-php.html on line 10

Warning: include_once(navigation4.php): failed to open stream: No such file or directory in /var/www/vhosts/bglbuddy.com/api/sample-php.html on line 13

Warning: include_once(): Failed opening 'navigation4.php' for inclusion (include_path='/var/www/vhosts/bglbuddy.com.com/includes:./includes:/var/www/vhosts/PHPMailer:/usr/share/pear:/usr/bin/pear') in /var/www/vhosts/bglbuddy.com/api/sample-php.html on line 13

ManageBGL API Sample with PHP

The ManageBGL API sample below allows you to login, retrieve an access token, and then add a BGL.

Login / Retrieve an Access Token

$url = "https://www.PredictBGL.com/api/1.0/login.json?email=" . urlencode($_POST['email']) . "&password=" . urlencode($_POST['password']);
$res = json_decode( file_get_contents($url), true);
if ($res['result']) {
  //success
  $token = $res['token'];
} else {
  //failed
}

Add Log

$url = "https://www.PredictBGL.com/api/1.0/add.json?token=" . urlencode($_POST['token']) .
"&value=" . urlencode($_POST['value']) .
"&notes=" . urlencode($_POST['notes']) .
"&log_type=" . urlencode($_POST['log_type']);
$res = json_decode( file_get_contents($url), true);
if ($res['result']) {
  //success
} else {
  //failed
}

Logout

$url = "https://www.PredictBGL.com/api/1.0/logout.json?token=" . urlencode($_POST['token']);
$res = json_decode( file_get_contents($url), true);
if ($res['result']) {
  //success
} else {
  //failed
}


Warning: include_once(footer4.php): failed to open stream: No such file or directory in /var/www/vhosts/bglbuddy.com/api/sample-php.html on line 64

Warning: include_once(): Failed opening 'footer4.php' for inclusion (include_path='/var/www/vhosts/bglbuddy.com.com/includes:./includes:/var/www/vhosts/PHPMailer:/usr/share/pear:/usr/bin/pear') in /var/www/vhosts/bglbuddy.com/api/sample-php.html on line 64