Reddybook Casino Games
Reddy Book IO New Launch
?php
// We will fetch ALL pages of the Countries List
// For a real live scenario, try to optimize your consumption
$countriesList = array();
$offset = 0;
$maxOffset = 1;
while($offset<$maxOffset) {
$json_result = file_get_contents('https://api.cricapi.com/v1/countries?apikey=[your api key]&offset='.$offset);
$j = json_decode($json_result);
if($j->status != "success") {
die("FAILED TO GET A SUCCESS RESULT");
}
$maxOffset = $j->info->totalRows;
$offset += count($j->data);
$countriesList = array_merge($countriesList,$j->data);
}
// Now the Countries List has ALL countries, you can use it for Display or to update your own Database
echo "Final countries List contains ".count($countriesList)." elements";
?>