XboxLeaders / XboxLiveAPI

[DEPRECATED] Please visit https://xboxapi.com for API services.
http://www.xboxleaders.com
MIT License
117 stars 26 forks source link

Fetch_games/Fetch_friends won't find capitalized gamer tags #58

Closed palesius closed 10 years ago

palesius commented 10 years ago

Fetch_games/Fetch_friends will not work when called on a gamer tag with non-initial caps. for example: https://www.xboxleaders.com/api/games.json?gamertag=Bushee%20Brow will work https://www.xboxleaders.com/api/games.json?gamertag=BUSHEE%20BROW will not work (even though the gamer tag is in fact all caps).

I looked at the actual traffic going to live.xbox.com, and it appears that the gamertag for the games page should be passed in the post data (not the query string as the api does).

When it is passed in the post data, both forms work.

I changed lines 236-238 to: $post_data = 'RequestVerificationToken=' . urlencode(trim($this->find($data, '<input name="RequestVerificationToken" type="hidden" value="', '" />'))) . '&compareTo=' . urlencode($gamertag); $headers = array('X-Requested-With: XMLHttpRequest', 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8');

and 314-316 to: $post_data = 'RequestVerificationToken=' . urlencode(trim($this->find($data, '<input name="RequestVerificationToken" type="hidden" value="', '" />'))) . '&compareTo=' . urlencode($gamertag); $headers = array('X-Requested-With: XMLHttpRequest', 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8'); $data = $this->fetch_url('https://live.xbox.com/' . $region . '/Friends/List', $url, 10, $post_data, $headers); $data = $this->fetch_url('https://live.xbox.com/' . $region . '/Activity/Summary?lc=1033', $url, 10, $post_data, $headers);