//////////////////////////////////////////////////// // Example of displaying SEMLA fixtures on another site // // Copyright (C) 2006-7 Dave Slaughter dave@purleylax.co.uk // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // See http://www.gnu.org/copyleft/lesser.html //////////////////////////////////////////////////// require_once('rest.inc'); $xmlfile = 'mens-fixtures-purley.xml'; // local file name to store XML data $xmlurl = 'http://www.southlacrosse.org.uk/rest/fixtures/mens/Purley'; // URL of data on South Lacrosse site // get the data from the South Lacrosse server, caching results for 2 hours $httpCache = new httpCache($xmlurl,$xmlfile); $httpCache->fetch(); // optimisation to send as little data as possible to the browser // Parameter is the dependancies of this page - currently only the xml // file, but if there are others then add to the array cacheHeaders(array($xmlfile)); // parse XML data into arrays for easier processing if (!$httpCache->isError()) { $parser = new simpleParser(); $xml = &$parser->parseString($httpCache->getXml()); } // output page heading ?>
Error retrieving data : ' . $httpCache->getError() . "
\n"; } elseif (!$xml) { echo 'Error converting data : ' . $parser->getError() . "
\n"; } else { ?>| Date | Home | Away | Competition | |||
|---|---|---|---|---|---|---|
| echo $date; ?> | echo $fixture->undefinedSafeGet('home-team'); ?> | echo $fixture->undefinedSafeGet('home-goals'); ?> | if (isset($fixture->{'home-team'}) || isset($fixture->{'away-team'})) echo 'v'; ?> | echo $fixture->undefinedSafeGet('away-goals'); ?> | echo $fixture->undefinedSafeGet('away-team'); ?> | echo htmlspecialchars($fixture->undefinedSafeGet('competition')); ?> |
Data provided by southlacrosse.org.uk