Пример #1
0
        // print $player_fullName.$player_id."\n";
        // Prepare Overall Record
        $allrecord = array('matchId' => $matchId, 'venuefullName' => $venuefullName, 'venueCity' => $venueCity, 'season' => "ipl" . $iplSeries, 'tossWin' => $tossWin, 'result' => $result, 'teamA' => $teamA["team"]["shortName"], 'teamB' => $teamB["team"]["shortName"], 'teamToBat' => $teamToBat);
        scraperwiki::save(array('matchId', 'season'), $allrecord);
    } else {
        print "Empty JSON FOR" . $matchId . "\n";
    }
    $matchNId++;
}
?>

<?php 
require 'scraperwiki/simple_html_dom.php';
$iplSeries = "2013";
//$html_content= scraperWiki::scrape("http://www.thatscricket.com/indian-premier-league/".$iplSeries."/");
ScraperWiki::attach("sqads", "src");
//$playerIds=scraperwiki::select("distinct player_id from src.swdata desc");
$matchNId = 1;
while ($matchNId <= 59) {
    //Carrer Stats http://dynamic.pulselive.com/test/data/core/cricket/careerStats/1_careerStats.js?_1363343668516=
    //http://dynamic.pulselive.com/dynamic/data/core/cricket/2012/ipl2012/ipl2012-70/scoring.js?_1364576135590=
    $json_content = scraperWiki::scrape("http://dynamic.pulselive.com/dynamic/data/core/cricket/2012/ipl" . $iplSeries . "/ipl" . $iplSeries . "-" . sprintf("%02s", $matchNId) . "/scoring.js?_1364576135590=");
    //print "JSON".$json_content;
    if (strpos($json_content, "The page is not found") === FALSE) {
        //http://dynamic.pulselive.com/dynamic/data/core/cricket/2012/ipl2012/23_careerStats.js
        $json_content = str_replace("onScoring(", "", $json_content);
        $json_content = str_replace(");", "", $json_content);
        $myMatchData = null;
        $myMatchData = json_decode($json_content, true);
        //var_dump($myPlayerData);
        // PLAYER DATA
                    <div id="roster"></div>
                </div>
                <div class="yui-u">
                    <div id="class_div"></div><div id="level_div"></div><div id="race_div"></div>
                </div>
            </div>
        </div>
        <div id="ft" role="contentinfo"><p>Last update on <?php 
echo $date;
?>
</p></div>
    </div>
  </body>
</html><?php 
$short_name = 'kon_members-1';
ScraperWiki::attach($short_name, 'src');
$keys = ScraperWiki::sqliteexecute("select * from swdata limit 0")->keys;
$data = ScraperWiki::select("* from swdata");
$class = array("captain" => 0, "lore-master" => 0, "rune-keeper" => 0, "guardian" => 0, "minstrel" => 0, "hunter" => 0, "burglar" => 0, "champion" => 0, "warden" => 0);
$level = array('0-9' => 0, '10-19' => 0, '20-29' => 0, '30-39' => 0, '40-49' => 0, '50-59' => 0, '60-65' => 0);
$race = array('elf' => 0, 'race of man' => 0, 'hobbit' => 0, 'dwarf' => 0);
$rank = array('leader' => 0, 'officer' => 0, 'member' => 0);
$members = array();
foreach ($data as $i => $member) {
    $class[strtolower($member->class)]++;
    $race[strtolower($member->race)]++;
    $rank[strtolower($member->rank)]++;
    $lvl = intval($member->level);
    $range = $lvl - $lvl % 10;
    if ($lvl <= 10) {
        $st = 0;