diff --git a/includes/classes/api.class.php b/includes/classes/api.class.php
index bb369e6..6764c3e 100644
--- a/includes/classes/api.class.php
+++ b/includes/classes/api.class.php
@@ -229,14 +229,14 @@ public function fetch_achievements($gamertag, $gameid, $region)
public function fetch_games($gamertag, $region)
{
$gamertag = trim($gamertag);
- $url = 'https://live.xbox.com/' . $region . '/Activity?compareTo=' . urlencode($gamertag);
+ $url = 'https://live.xbox.com/' . $region . '/Activity';
$key = $this->version . ':games.' . $gamertag;
$data = $this->__cache->fetch($key);
$freshness = 'from cache';
if (!$data) {
$data = $this->fetch_url($url);
- $post_data = '__RequestVerificationToken=' . urlencode(trim($this->find($data, '')));
+ $post_data = '__RequestVerificationToken=' . urlencode(trim($this->find($data, ''))) . '&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 . '/Activity/Summary?compareTo=' . urlencode($gamertag) . '&lc=1033', $url, 10, $post_data, $headers);
$freshness = 'new';
diff --git a/includes/classes/base.class.php b/includes/classes/base.class.php
index be625c4..e2e6869 100644
--- a/includes/classes/base.class.php
+++ b/includes/classes/base.class.php
@@ -82,8 +82,8 @@ public function __construct($cache)
public function init($email, $password)
{
// Email and password. Make sure it's URL-friendly.
- $this->email = str_replace('@', '%40', strtolower($email));
- $this->password = $password;
+ $this->email = urlencode($email);
+ $this->password = urlencode($password);
// Check the login session to make sure it's valid.
if ($this->check_login()) {