Page 1 of 1

[Fixed] MultiplayerRankings: Syntax error, malformed JSON

Posted: 06 May 2011, 16:00
by TheM
I'm just trying out every bit of the Web Services, and I came across this:

Code: Select all

$rankings['multiplayer'] = new TrackMania_MultiplayerRankings($username, $password);

$info = $rankings['multiplayer']->getPlayerRanking();
print_r($info);
Gives the following error:

Code: Select all

Fatal error: Uncaught exception 'TrackMania_Exception' with message 'Syntax error, malformed JSON' in E:\xampp\htdocs\tmws\src\trackmania-ws.php:471
Stack trace:
#0 E:\xampp\htdocs\tmws\src\trackmania-ws.php(347): TrackMania_WebServices->execute('GET', '/tmf/rankings/m...', Array)
#1 E:\xampp\htdocs\tmws\src\trackmania-ws.php(55): TrackMania_WebServices->executeGET('/tmf/rankings/m...', Array)
#2 E:\xampp\htdocs\tmws\tmws.php(24): TrackMania_MultiplayerRankings->getPlayerRanking()
#3 {main} thrown in E:\xampp\htdocs\tmws\src\trackmania-ws.php on line 471
Same goes for getZoneRanking() ...

Re: [MultiplayerRankings] Syntax error, malformed JSON

Posted: 06 May 2011, 16:22
by gouxim
As it turns out, the the method with optional parameters do not work when you don't set the optional params :(

I am working on a fix and should update the SDK :)

In the meantime you can call the method with all the parameters:

Code: Select all

$info = $rankings['multiplayer']->getPlayerRanking('World', 'Merge', 0, 10);

Re: [MultiplayerRankings] Syntax error, malformed JSON

Posted: 06 May 2011, 16:53
by TheM
Ah, that works... thanks! :)

I think that func_get_args() only gets the parameters which are given, but you probably already found that :P

Re: [MultiplayerRankings] Syntax error, malformed JSON

Posted: 06 May 2011, 17:08
by gouxim
Yes indeed :) I updated the SDK accordingly. Check the SDK topic for download link and changelog !