DeletedUser
Guest
There is a post made about World Data, but many of the features have changes since then.
Available Data
Alliances -- http://en1.grepolis.com/data/alliances.txt
Players -- http://en1.grepolis.com/data/players.txt
Towns -- http://en1.grepolis.com/data/towns.txt
Islands -- http://en1.grepolis.com/data/islands.txt Only download once!
Conquest -- http://en1.grepolis.com/data/conquers.txt
units -- http://en1.grepolis.com/data/units.json
Here is a sample of how I handled a data import:
Available Data
Alliances -- http://en1.grepolis.com/data/alliances.txt
Players -- http://en1.grepolis.com/data/players.txt
Towns -- http://en1.grepolis.com/data/towns.txt
Islands -- http://en1.grepolis.com/data/islands.txt Only download once!
Conquest -- http://en1.grepolis.com/data/conquers.txt
units -- http://en1.grepolis.com/data/units.json
Here is a sample of how I handled a data import:
Code:
<?php
$dbh=mysql_connect ("localhost", "dbuser",
"dbpass") or die('Cannot connect to the database because: ' . mysql_error());
mysql_select_db ("dbdatabase");
ini_set("memory_limit","100M");
mysql_query("Truncate Table players");
$datafile = file('http://en1.grepolis.com/data/players.txt');
if(!is_array($datafile)) die("File could not be opened");
foreach($datafile as $datum){
list($id, $name, $alliance_id, $points, $rank, $towns) = explode(',', $datum);
If (isset($alliance_id)){ $alliance_id=0; }
If (isset($points)){ $points=0; }
If (isset($rank)){ $rank=0; }
If (isset($towns)){ $towns=0; }
$INSERT = "INSERT INTO `players` (`id`, `name`, `ally`, `points`, `rank`, `villages`) VALUES ($id, '$name', $alliance_id, $points, $rank, $towns)";
$result = mysql_query("$INSERT");
if (!$result) {
print"$id, $name, $alliance_id, $points, $rank, $towns <br> alliance_id='$alliance_id' <br>";
print"$INSERT <br>";
die('Invalid query: ' . mysql_error());
}
}
print "The database has been updated";
mysql_close($dbh);
?>