You are not logged in.

Dear visitor, welcome to OGame.Origin. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

Francolino

OGame Origin Admin

  • "Francolino" is male
  • "Francolino" started this thread

Posts: 3,550

Community:

Location: Switzerland

  • Send private message

1

Wednesday, April 11th 2012, 11:39pm

OGame API

Hello,

Available since Ogame 4.1

http://uni670.ogame.org/api/players.xml - Updateinterval 1 day
http://uni670.ogame.org/api/universe.xml - Updateinterval 1 week

http://uni670.ogame.org/api/highscore.xml?category=1&type=1 - Updateinterval 1 hour - ( all possible parameter http://uni670.ogame.org/api/highscore.xml )
http://uni670.ogame.org/api/alliances.xml - Updateinterval 1 day

http://uni670.ogame.org/api/serverData.xml - Updateinterval 1 day
http://uni670.ogame.org/api/playerData.xml - Updateinterval 1 week

http://uni670.ogame.org/api/localization.xml - Added in Ogame 5.2.2

http://uni670.ogame.org/api/universes.xml - Added in OGame 5.5

Regards, Francolino

Quoted

The homeplanet is the one with the lowest planet id


Quoted


type Name for highscore
0 Total
1 Economy
2 Research
3 Military
5 Military Built
6 Military Destroyed
4 Military Lost
7 Honor

2

Sunday, June 10th 2012, 8:29pm

Hello,
You have absolutely right.
This is my simple code

I have tested with EasyPhp and Anigame it work's :phatgrin:


Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php

$GAMER=$_GET['spieler'];
$PREFIX="http://uni104.ogame.it/";

$XMLURL="";
$NUMERO=0;

$XMLURL=$PREFIX . "api/players.xml";

echo "<center>";

/*

if (file_exists($XMLURL)) {
    $xml = simplexml_load_file($XMLURL);
 
    print_r($xml);
} else {
    exit('Failed to open test.xml.');
}
*/

$xml = simplexml_load_file($XMLURL);


foreach($xml->children() as $child)
  {
	if (strcmp(strtoupper($child["name"]),strtoupper($GAMER))==0)
	{
	  echo  $child["name"] . "&nbsp;&nbsp;(" . $child["status"] . ")<br><br>";
	  echo "<table border=1><tr align=center><td>Coordinate</td><td>Colonia</td><td>Luna</td></tr>";

		
		$XMLURL=$PREFIX . "api/playerData.xml?id=" . $child["id"];
		$pp = simplexml_load_file($XMLURL);


		foreach($pp->children() as $pp01)
		  {
			if (strcmp($pp01->getName(),"planets")==0)
			{
				foreach($pp01->children() as $pp02)
				{
				  $aa = explode(":", $pp02["coords"]);
				  $LINKO=$PREFIX . "game/index.php?page=galaxy&no_header=1&";
				  echo "<tr align=center><td><a target=_blank href=" . $LINKO . "galaxy=" . $aa[0] . "&system=" . $aa[1] ."&planet=" . $aa[2] . ">" . $pp02["coords"] . "</a></td><td>" . $pp02["name"] . "</td>";
				  $NUMERO=$NUMERO+1;
					foreach($pp02->children() as $luna)
					{
					  echo "<td>" . $luna["name"] . "</td></tr>";
					}
				}
			}
		  }
	}


  }

echo "</table>";
echo "<br>Totale Pianeti " . $NUMERO;
echo "</center>";
?>

benneb

Origin Admin & OGame Tech

Posts: 658

Community:

  • Send private message

3

Monday, February 4th 2013, 6:59pm

Archived spam, and updated

4

Friday, February 8th 2013, 1:20pm

Hello, I´d like to suggest that highscore.xml without type parameter give all the types as attributes for every player/alliance.
For example:

Source code

1
<player id="302163" score_0="3962478" position_0="1" score_1="3962478" position_1="1" ships="10" .../>

I´m actually using this file and storing it´s values in database and I can tell you, that it take several minutes to walk through 7 files for each players and alliance when you have about 6k players in the universe. So this could speed up the process about 7 times.
And if someone doesn´t need all of the attributes he will be still able to use type parameter.

Or is there any quick&easy way to merge these files together in PHP?

Omar Hawk

OGame.Tech, Tools&Skins, IdeasPlanet

  • "Omar Hawk" is male

Posts: 196

Community:

  • Send private message

5

Friday, February 8th 2013, 6:37pm

I'm not really sure, what you want to do.

If you want to get data for only a single player, there is the playerData.xml, whch contains also all the highscore values for a single player.
If you just want to read in all the data into tables and this is taking several minutes you are doing something really wrong. E.g. the Galaxytool requires a maximum of 10s to read all API files (universe.xml + all highscore files) and INSERT the complete data into a MySQL database. For small universes, the required time is even less!

6

Saturday, February 9th 2013, 8:55pm

well, it turned out that you were right, my code wasn´t optimized. I managed to get the highscore update time down to 3.5s for 3500 players.
But it could be about a half without having to go through 7 files, so I think it might be worth it.

7

Monday, March 25th 2013, 3:34pm

what is the update interval of localization.xml?
edit: it seems to be 1 day

8

Tuesday, March 26th 2013, 6:29pm

in 5.4:

Quoted

[Feature Request] OGame API additions (extra fields setting)

I noticed that moon size is added in playerData.xml, can we have more infos?

Francolino

OGame Origin Admin

  • "Francolino" is male
  • "Francolino" started this thread

Posts: 3,550

Community:

Location: Switzerland

  • Send private message

9

Wednesday, March 27th 2013, 12:23am

in 5.4:

Quoted

[Feature Request] OGame API additions (extra fields setting)

I noticed that moon size is added in playerData.xml, can we have more infos?


Details are not final yet, i'll post them later.

10

Monday, April 22nd 2013, 8:51am

Details are not final yet, i'll post them later.

I'm almost sure it's final now ;)

11

Monday, April 22nd 2013, 11:26am

My last update from Francolino was that this feature is delayed.

12

Monday, April 22nd 2013, 7:10pm

My last update from Francolino was that this feature is delayed.

no, as I said they added moon size in playerData.xml, but what else??? we still don't have any information

jrme

.fr Representative & Ogametech

  • "jrme" is male

Posts: 48

Community:

  • Send private message

13

Thursday, April 25th 2013, 2:26pm

Moonsize in playerData.xml And when there is a bonus to the size of the primary planet, it is now indicated in in serverData.xml.

And btw this has been posted on .fr board few days ago ;-)

14

Thursday, April 25th 2013, 7:10pm

thanks jrme
And btw this has been posten on .fr board few days ago ;-)

it has been posted on .fr board on 23rd of april, my post is posted on 22nd of april ;)

jrme

.fr Representative & Ogametech

  • "jrme" is male

Posts: 48

Community:

  • Send private message

15

Thursday, April 25th 2013, 8:46pm

My bad :x Sorry ;-)

NeoArc

Tools&Skins

Posts: 9

Community:

  • Send private message

16

Saturday, April 27th 2013, 12:52am

So...
I think you should provide a json version of the API, since modern browsers have a JSON parser included.
For older browsers there's a plugin available.

https://github.com/douglascrockford/JSON-js

Use of JSON would reduce browser plugin code size and maintenance times.

17

Saturday, April 27th 2013, 12:05pm

Json would indeed be faster and more usefull in some cases.
I'd also like to test that !

But i'd still like to have the xml version for now :)
Because it's easy to use native DOM to search for nodes etc !

Francolino

OGame Origin Admin

  • "Francolino" is male
  • "Francolino" started this thread

Posts: 3,550

Community:

Location: Switzerland

  • Send private message

18

Wednesday, May 8th 2013, 4:45pm

Serverlist for each community - added with OGame 5.5:

http://uni670.ogame.org/api/universes.xml

- This file is hosted on all universe server for each community




Using JSON for such a huge amount of Data is not senseful.

- You can't handle exceptions well
- The browser (tab) freezes for many seconds while parsing the object, and much more on mobile devices

But i'd still like to have the xml version for now
Because it's easy to use native DOM to search for nodes etc !


That's it, thanks :)


Please be glad THAT there is an API, and using XML is much more flexible.

19

Thursday, May 9th 2013, 11:29am

endless war between JSON and XML.

For me JSON is much easier to parse (in particular for languages that ain't javascript). But I don't want to discuss with you advantages and disadvantages but

Why not both? Give everyone what he things is best.

20

Thursday, May 9th 2013, 12:54pm

I agree with Francolino, it's not a good habit to use JSON for a big amount of data, because you must parse all data before reading them and you never need everything
it takes too much time for nothing... when you can use XML to read the particular element you need at a moment, and read another element for instance 10 seconds later if you need it at this time (it's what i do here with players.xml and highscore.xml)

NeoArc

Tools&Skins

Posts: 9

Community:

  • Send private message

21

Thursday, May 9th 2013, 1:19pm

I didn't mean to discard the XML version of the API. I think the API is awesome as it is right now.
You are right about the browser freezing on older computers (and mobile devices)

Edit: I can't delete my post, and we'll have to wait until this thread reaches 40 messages...


BTW I realize there's not a big difference comparing the original xml file with my json version. I think the attached file could be compressed more (and it can be modified to be more readable).

About the comparison with xpath, I'd save a modified version of the data in local Storage, with indexes (properties). Really fast:

players: {player_100233: {name: John Doe, alliance_id: 23544}, player_100234: {name: John Lennon, alliance_id: 23543} }


Bug (as seen in the edit message page):

Fatal error: PHP notice in file
/home/www/boards/board.origin.ogame.de/wcf/templates/compiled/22_0_14_attachmentsEdit.php
(22): Undefined index: messageID
NeoArc has attached the following files:

This post has been edited 3 times, last edit by "NeoArc" (May 16th 2013, 2:20pm)


NeoArc

Tools&Skins

Posts: 9

Community:

  • Send private message

22

Thursday, May 9th 2013, 1:21pm

I think the forum has a bug when showing attached files...

23

Friday, May 10th 2013, 1:37am

I agree with Francolino, it's not a good habit to use JSON for a big amount of data, because you must parse all data before reading them and you never need everything
it takes too much time for nothing... when you can use XML to read the particular element you need at a moment, and read another element for instance 10 seconds later if you need it at this time (it's what i do here with players.xml and highscore.xml)

which is correct for your usecase black cat. but there might be other applications where it is vice versa.

there are many arguments that favor JSON over XML. in the end you will always find projects which are better suitable for one of em BUT you can't say that one is bad and useless.

btw you talk from a browser which is parsing an ajax request right? the answer is a bytestream which than needs to be parsed whether it is json or xml. modern browsers surely will have been optimized for both so i would assume that your argument is neither a pro nor a contra for xml over JSON.

24

Friday, May 10th 2013, 7:54pm

JSON is a format for light-weight data exchange
it could be use for serverData.xml but it doesn't make sense to use it for universe.xml for instance

25

Monday, May 13th 2013, 11:20am

JSON is a format for light-weight data exchange
it could be use for serverData.xml but it doesn't make sense to use it for universe.xml for instance


Why do you want to force JSON in one category? JSON is able to do 100% the same stuff like XML does.

Even for big universe.xml would make sense as JSON. Please accept that somebody might want to use it as his personal favor or because his source code is better at reading JSON than XML. Or do you say "no I don't publish a book in bulgarian because not many do speak it"? This is just silly.
Or otherwise said I would rather use a JSON parser of 200 loc in C# than importing a whole XML libary which lets my code increase by a huge amount.

Francolino

OGame Origin Admin

  • "Francolino" is male
  • "Francolino" started this thread

Posts: 3,550

Community:

Location: Switzerland

  • Send private message

26

Monday, May 13th 2013, 5:33pm

Hello,

There is no need to offer both ways ( XML and JSON ) for the API. Everyone can parse the (more flexible) XML files with a few lines of code, so it's the first and only choice.

27

Tuesday, May 14th 2013, 3:07pm

Your argument is invalid. XML is not more flexible than JSON since both data description languages can do exactly the same.

Nevertheless you are completly right that (AND ONLY if there can only be one) XML is most likely best way (for this problem).

28

Tuesday, May 14th 2013, 3:16pm

It's very easy to create external website to convert XML to JSON and exploit it in your program (similar to a proxy).

Similar threads