AGW_AGE_CACHE)) { $agwFeed = simplexml_load_file(AGW_CACHE); $agwProcess = false; } /** * If we don't have a cache then we'll need to build one */ if ($agwProcess === true) { /** * Set up global options for cURL to utilize for the transfer. */ $options = array(CURLOPT_FORBID_REUSE => true, CURLOPT_POST => false, CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 3, CURLOPT_USERAGENT => 'Mozilla/5.0 (Compatible; libCURL)', CURLOPT_VERBOSE => false); /** * Initialize cURL */ $agwFeedSource = curl_init(AGW_FEED); curl_setopt_array($agwFeedSource, $options); /** * Execute cURL container and store the output */ $agwFeedOutput = curl_exec($agwFeedSource); /** * Parse the received data */ if (!curl_errno($agwFeedSource)) { $agwFeed = simplexml_load_string($agwFeedOutput); $agwXml = new SimpleXMLElement($agwFeedOutput); file_put_contents(AGW_CACHE, $agwXml->asXML(), LOCK_EX); curl_close($agwFeedSource); } else { curl_close($agwFeedSource); } /** * Check to make sure the results are not empty before proceeding. */ if (empty($agwFeed) || !is_object($agwFeed)) $agwFeed = array(); } /** * Process output */ foreach ($agwFeed->channel->item as $item) { if ($item->category != 'Tournament Announcements') continue; echo '' . '' . $item->title . '
' . '' . $item->pubDate . '


' . PHP_EOL; } // }}} ?>