It’s come to my attention that the nice folks over at EA have changed their login routine for the Web App which breaks the code I posted previously.

I’ve had a quick look and managed to create a test PHP file that retrieves the session data that you need to login and show the results of a search for Berbatov. I’ll post the example code here while I work on correcting the classes I have on GitHub. I must stress that this will probably only work for Xbox and before anyone asks I’m not interested in writing you an Autobuyer, someone has created one here: http://lazyonline.wordpress.com/


<?PHP
$user = "";
$password = "";
$hash = "";

$login = "https://www.ea.com/uk/football/services/authenticate/login";

$opts = array(
 'http'=>array(
 'method'=>"POST",
 'header'=>"Content-Type: application/x-www-form-urlencoded\r\n".
 "User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.57 Safari/537.17\r\n".
 "Referer:http://www.ea.com/uk/football/login?redirectUrl=http://www.ea.com/uk/football/fifa-ultimate-team",
 'content'=>"email=".$user."&password=".$password."&stay-signed=ON"
 )
);

$context = stream_context_create($opts);
$EASW = file_get_contents($login, false, $context);
$r = $http_response_header;

//print_r($r);

$s = explode(":", $r[10]);
$t = explode(";", $s[1]);
$EASW_KEY = $t[0];

$m = explode(":", $r[11]);
$n = explode(";", $m[1]);
$o = explode(";", $m[2]);
$EASF_SESS = $n[0] . $o[0];

$p = explode(":", $r[12]);
$q = explode(";", $p[1]);
$EASF_PERS = $q[0];

//nuc
$a = explode("<nucleusId>", $EASW);
$b = explode("</nucleusId>", $a[1]);
$NUC = $b[0];

//echo "HTML Header:";
//var_dump($http_response_header);
echo $EASW_KEY;
echo "<br />";
echo $EASF_SESS;
echo "<br />";
echo $EASF_PERS;
echo "<br />";
echo "NUC: $NUC <br />";

unset($opts, $context, $EASW, $http_response_header, $r, $s, $t);

$time = time();
$shard = "http://www.ea.com/p/fut/a/card/l/en_GB/s/p/ut/shards?timestamp=". $time;
$opts = array(
 'http'=>array(
 'method'=>"GET",
 'header'=>"Content-Type: application/json\r\n".
 "Cookie: ".$EASW_KEY.";". $EASF_SESS
 )
);

$context = stream_context_create($opts);
$EASW = file_get_contents($shard, false, $context);
$r = $http_response_header;
//echo "HTML Header:";
//var_dump($http_response_header);
$d = json_decode($EASW);
//var_dump($d);
$machine = $d->shardInfo[0]->customdata1[0];

unset($opts, $context, $EASW, $http_response_header, $r, $d);

$acount = "http://www.ea.com/p/fut/a/" . $machine . "/l/en_GB/s/p/ut/game/fifa13/user/accountinfo?timestamp=". $time;
$opts = array(
 'http'=>array(
 'method'=>"GET",
 'header'=>"Content-Type: application/json\r\n".
 "User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.57 Safari/537.17\r\n".
 "Referer:http://www.ea.com/uk/football/login?redirectUrl=http://www.ea.com/uk/football/fifa-ultimate-team\r\n".
 "Cookie: ".$EASF_SESS.";".$EASW_KEY
 )
);

$context = stream_context_create($opts);
$EASW = file_get_contents($acount, false, $context);
$r = $http_response_header;
//echo "HTML Header:";
//var_dump($http_response_header);
$d = json_decode($EASW);
//var_dump($d);
$id = $d->userAccountInfo->personas[0]->personaId;
$platform = $d->userAccountInfo->personas[0]->userClubList[0]->platform;

unset($opts, $context, $EASW, $http_response_header, $r);

$auth = "http://www.ea.com/p/fut/a/" . $machine . "/l/en_GB/s/p/ut/auth";
$opts = array(
 'http'=>array(
 'method'=>"POST",
 'header'=>"Content-Type: application/json\r\n".
 "User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.57 Safari/537.17\r\n".
 "Referer:http://www.ea.com/uk/football/login?redirectUrl=http://www.ea.com/uk/football/fifa-ultimate-team\r\n".
 "Cookie: ".$EASW_KEY.";".$EASF_SESS,
 'content'=>'{ "isReadOnly": false, "sku": "393A0001", "clientVersion": 3, "nuc": 2266826199, "nucleusPersonaId": '.$id.', "nucleusPersonaDisplayName": "Bot", "nucleusPersonaPlatform": "'.$platform.'", "locale": "en-GB", "method": "idm", "priorityLevel":4, "identification": { "EASW-Token": "" } }'
 )
);

$context = stream_context_create($opts);
$EASW = file_get_contents($auth, false, $context);
$r = $http_response_header;
//echo "HTML Header:";
//var_dump($http_response_header);
$XSID = $r[3];
echo $XSID;

unset($opts, $context, $EASW, $http_response_header, $r);

$quest = "http://www.ea.com/p/fut/a/" . $machine . "/l/en_GB/s/p/ut/game/fifa13/phishing/validate";

$opts = array(
 'http'=>array(
 'method'=>"POST",
 'header'=>"Content-Type: application/x-www-form-urlencoded\r\n".
 "User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.57 Safari/537.17\r\n".
 "Referer:http://www.ea.com/uk/football/login?redirectUrl=http://www.ea.com/uk/football/fifa-ultimate-team\r\n".
 "Cookie: ".$EASW_KEY."; ".$EASF_SESS ."\r\n".
 $XSID,
 'content'=>"answer=".$hash
 )
);

$context = stream_context_create($opts);
$PHISHING = file_get_contents($quest, false, $context);
$r = $http_response_header;
//echo "HTML Header:";
//var_dump($http_response_header);
$s = explode(":", $r[11]);
$t = explode(";", $s[1]);
$PHISHKEY = $t[0];
echo "<br />". $PHISHKEY;

unset($opts, $context, $EASW, $http_response_header, $r);</pre>
$opts = array(
 'http'=>array(
 'method'=>"POST",
 'header'=>"Content-Type: application/json\r\n".
 "User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.57 Safari/537.17\r\n".
 "Referer:http://www.ea.com/uk/football/login?redirectUrl=http://www.ea.com/uk/football/fifa-ultimate-team\r\n".
 "Cookie: ".$EASW_KEY."; ".$EASF_SESS ."; ".$PHISHKEY."\r\n".
 "x-http-method-override:GET\r\n".
 $XSID
 )
);
$start = 0;

$context = stream_context_create($opts);
 $search = "https://utas.fut.ea.com/ut/game/fifa13/auctionhouse?leag=13&team=144&num=16&zone=attacker&nat=9&lev=gold&type=player&start=".$start;
 $RESULTS = file_get_contents($search, false, $context);
 //$r = $http_response_header;

//var_dump($http_response_header);
 //echo $RESULTS;

$dere = json_decode($RESULTS);
 //var_dump($dere);
 if (count($dere->auctionInfo) == 0){
 break;
 }

FOREACH ($dere->auctionInfo as $auction){
 echo "<br />";
 $rid = $auction->itemData->resourceId;
 $l = 0;
 WHILE ($rid > 16777216){
 $l++;
 if ($l == 1){
 $rid -= 1342177280;
 }elseif ($l == 2){
 $rid -= 50331648;
 }else{
 $rid -= 16777216;
 }
 }

 echo '<img src= "http://cdn.content.easports.com/fifa/fltOnlineAssets/2013/fut/items/images/players/web/'.$rid.'.png" alt="'.$rid.'"></img><br />';
 echo "Trade ID: ". $auction->tradeId ."<br />";
 echo "Resource ID: ". $auction->itemData->resourceId ."<br />";
 echo "Base ID: ". $rid ."<br />";
 echo "Player Version: ". $l ."<br />";
 echo "Rating: " . $auction->itemData->rating ."<br />";
 echo "Rare Flag: " . $auction->itemData->rareflag ."<br />";
 echo "Starting Bid: ". $auction->startingBid ."<br />";
 echo "Current Bid: ". $auction->currentBid ."<br />";
 echo "BIN Price: ". $auction->buyNowPrice ."<br />";
 echo "<br />";
 }

 $start += 15;

?>