echo $e->getMessage() . "\n"; $lastResponse = $library->getLastResponse(); var_dump($lastResponse); echo "Last Response Body: " . $lastResponse->getRawBody() . " \n"; die("Leaving\n"); } $library->items->addChildKeys(); $items = array(); foreach ($itemKeys as $key) { $item = $library->items->getItem($key); if ($item !== false && empty($item->links['up'])) { $items[] = $item; } } $zreport = new ZReport(); $zreport->setLibrary($library); $zreport->baseUrl = $baseUrl; //clear the cache for static generation - the static files are our cache //apc_clear_cache('user'); //$items = $library->fetchItems(array('collectionKey'=>$reportCollectionKey, 'limit'=>100)); echo "have items: " . count($items) . "\n"; $pages = $zreport->writePages($items); for ($i = 0; $i < count($pages); $i++) { $zreport->savePage($pages[$i], $i + 1); } //save library if ($libraryCacheType == 'file') { file_put_contents($librarySaveFilePath, serialize($library)); } elseif ($libraryCacheType == 'apc') { apc_store('zreportlibrarycache', $library); }