Difference between revisions of "Sourcerer Implementation Notes"
From Geohashing
imported>Sourcerer m (→PHP Downloads) |
imported>Sourcerer m (→php example) |
||
Line 31: | Line 31: | ||
$html = file_get_contents('http://wiki.xkcd.com/wgh/api.php?action=query&list=categorymembers&cmtitle=Category:Consecutive_geohash_achievement&cmlimit=20'); | $html = file_get_contents('http://wiki.xkcd.com/wgh/api.php?action=query&list=categorymembers&cmtitle=Category:Consecutive_geohash_achievement&cmlimit=20'); | ||
echo $html; | echo $html; | ||
+ | ?> | ||
+ | |||
+ | === PHP Code - As above but use JSON === | ||
+ | |||
+ | <?php | ||
+ | $json = file_get_contents('http://wiki.xkcd.com/wgh/api.php?action=query&format=json&list=categorymembers&cmtitle=Category:Consecutive_geohash_achievement&cmlimit=20'); | ||
+ | $readable = json_decode($json, true); | ||
+ | print_r($readable); | ||
?> | ?> |
Revision as of 14:44, 8 February 2015
Contents
Plan of Campaign
My plan is to create some new analysis tools for this wiki. This page might help others to implement their tools.
- Get some page content ("Hello World!").
- Write some code (perhaps PHP command line code) to do the same. Make sure this does not overload the wiki.
- Download different kinds of page.
- Do some simple statistics on the downloaded data.
- Create reports in wiki markup.
- If it works, upload them to the wiki.
Various Downloads
Help Page
JSON Page Content Dump
List first twenty of Consecutive geohash achievement
List twenty more of Consecutive geohash achievement
PHP Code - List first twenty of Consecutive geohash achievement - Command line application
<?php $html = file_get_contents('http://wiki.xkcd.com/wgh/api.php?action=query&list=categorymembers&cmtitle=Category:Consecutive_geohash_achievement&cmlimit=20'); echo $html; ?>
PHP Code - As above but use JSON
<?php $json = file_get_contents('http://wiki.xkcd.com/wgh/api.php?action=query&format=json&list=categorymembers&cmtitle=Category:Consecutive_geohash_achievement&cmlimit=20'); $readable = json_decode($json, true); print_r($readable); ?>