A modification was needed to load the data
function mlu_bgg_load_from_api ($url, $cat, $entry, $bypass = false, $dontsave = false) {
// First, check to see if this is in the cache.
if (!$bypass) {
$contents = mlu_bgg_get_cache_contents ($cat, $entry);
if ($contents != null) {
// It is! So return in.
return $contents;
}
}
// Oh god, now we've got to go to the server. Let's hope it's working!
// $file = fopen ($url, "r");
//
// if ($file == null) {
// if ($contents != null) {
// return $contents;
// }
// return "";
// }
//
// $contents = "";
//
// while (!feof($file)) {
// // Read in the XML. Read it all in.
// $contents .= fread($file, 8192);
// }
//
//
// fclose($file);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$contents = curl_exec($ch);
// That seems to have gone well enough, so let's store what we got in the cache.
// Let's not tempt fate.
if (!$bypass && !$dontsave) {
mlu_bgg_set_cache_contents ($cat, $entry, $contents);
}
return $contents;
}
[bgg id=229853]
[bgg id=244521]
