Jump to content

Recommended Posts

I have just recently began learning PHP. I have a pretty solid foundation in general programming and PHP. As my first major PHP project I am trying to make myself an autobuyer for Fifa 15 using curt2008 Fifa API. He basically has everything there for me to use and I know that I have enough knowkledge to get a basic autobuyer going if I could just figure out how to log in. I have come to realize that the problem is that I have no idea what he is doing when he connects to the Fifa Web App. He has the code there for me, but I don't know what it is actually doing. I was hoping someone can point me to some documentation, a tutorial, or even exercises so that I may learn more about... logining into a web application? I don't even know what to call it.

 

Looking at connect.php he has a bunch of functions. Login, getSessionID, Phishing, getNucleusID, getShards, and all of them do a bunch a requests and use a bunch of headers. I don't know what this terminology is or how it all works together, but I would like to learn about it. Thats why I wanted to start learning PHP, for stuff like this. I just don't know where to look.

 

Thank You

Link to comment
https://forums.phpfreaks.com/topic/293764-taking-php-to-the-next-step/
Share on other sites

 

He basically has everything there for me to use and I know that I have enough knowkledge to get a basic autobuyer going if I could just figure out how to log in.

He showed it in the sample.php. Change the user credentials to your own. Change to whichever platform needed.

$datos = array(
"username" => "email@email.com",
"password" => "password",
"platform" => "xbox360", // xbox360, pc, ps3
"hash" => "md5hash", // answer in hash
);
Looking at connect.php he has a bunch of functions. Login, getSessionID, Phishing, getNucleusID, getShards, and all of them do a bunch a requests and use a bunch of headers. I don't know what this terminology is or how it all works together, but I would like to learn about it.

 

Yes there is a bunch of functions, all made so wouldn't need to learn.

What all that does is log you in and emulate a browser and if you were a user logged in

 

What you probably missed is that the person wrote that using guzzle framework

Is not a complete autobuyer, it connects and returns json data.

 

Would be up to you to create some sort of algorithm or buying/selling patterns using the data.

 

Lets imagine we don't use the guzzle framework or even the curt2008 Fifa API.

You would need to log into a site using your credentials.

The expected way would be a person using a browser, instead we use a server and connect emulating a browser.

curl would be my choice to connect and return data, there are also other methods that may be better depending the type of data or simplicity.

You would visit each of your desired urls you plan to scrape/parse data from.

You can use this data directly or create an api such as that person did, by making it all into an array and creating headers for the browser, show as json data.

json_decode can be used to make the json data back into a normal array or directly access the objects.

 

Here is another post I did explaining api's, methods to parse data and some useful information about them.

http://forums.phpfreaks.com/topic/291985-how-to-make-useful-native-apps/?p=1494550

I did see the sample and I have filled in all the information, but I seem to get errors. I figured it was becuase I didn't understand the code well enough.

 

My user information is all correct I know that much and I guess the only other reason I can come up with is I hashed the Security question wrong. This is what I am trying to run.

 

 

<?php
    define("CLASSES", $_SERVER['DOCUMENT_ROOT']."Fifa 15 Autobuyer/classes");
    
    require CLASSES."/Guzzle/guzzle.phar";
    require CLASSES."/connector.php";
    require CLASSES."/eahashor.php";
    require CLASSES."/searchor.php";
    
    $email = '**********************';
    $password = '*********';
    $hash = (new EAHashor())->eaEncode('pembrokemiddle');
    
    $loginDetails = array(
        "username" => $email,
        "password" => $password,
        "hash" => $hash, //must be a value hashed using EAHashor
        "platform" => "PS", //XBOX or PS
    );
    
    $connector = new Connector($loginDetails);
    $con = $connector->Connect();
?>

 

This is my output and some of the many errors.

 

 

nuc = $data['nuc']; $this->sess = $data['sess']; $this->phish = $data['phish']; $this->console = $data['console']; if($data['cookie']) { $this->_cookieFile = $data['cookie']; } } public function getCredits() { $client = new Client(null); if($this->_cookieFile) { $cookiePlugin = new CookiePlugin(new FileCookieJar($this->_cookieFile)); $client->addSubscriber($cookiePlugin); } $client->setUserAgent("Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.62 Safari/537.36"); switch($this->console) { case "XBOX": $request = $client->post("https://utas.fut.ea.com/ut/game/fifa15/user/credits"); break; case "PS": $request = $client->post("https://utas.s2.fut.ea.com/ut/game/fifa15/user/credits"); break; } $request->addHeader('Origin', 'http://www.easports.com'); $request->setHeader('Referer', 'http://www.easports.com/iframe/fut/bundles/futweb/web/flash/FifaUltimateTeam.swf'); $request->addHeader('X-HTTP-Method-Override', 'GET'); $request->addHeader('X-UT-Embed-Error', 'true'); $request->addHeader('X-UT-PHISHING-TOKEN', $this->phish); $request->addHeader('X-UT-SID', $this->sess); $response = $request->send(); $json = $response->json(); return $json; } public function tradeInfo($tradeId) { $client = new Client(null); if($this->_cookieFile) { $cookiePlugin = new CookiePlugin(new FileCookieJar($this->_cookieFile)); $client->addSubscriber($cookiePlugin); } $client->setUserAgent("Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.62 Safari/537.36"); switch($this->console) { case "XBOX": $request = $client->post("https://utas.fut.ea.com/ut/game/fifa15/trade/status?tradeIds=".$tradeId); break; case "PS": $request = $client->post("https://utas.s2.fut.ea.com/ut/game/fifa15/trade/status?tradeIds=".$tradeId); break; } $request->addHeader('Origin', 'http://www.easports.com'); $request->setHeader('Referer', 'http://www.easports.com/iframe/fut/bundles/futweb/web/flash/FifaUltimateTeam.swf'); $request->addHeader('X-HTTP-Method-Override', 'GET'); $request->addHeader('X-UT-Embed-Error', 'true'); $request->addHeader('X-UT-PHISHING-TOKEN', $this->phish); $request->addHeader('X-UT-SID', $this->sess); $response = $request->send(); $json = $response->json(); return $json; } public function playerSearch($playerId = 0, $minbin = 0, $maxbin = 0, $start = 0, $num = 16) { $client = new Client(null); if($this->_cookieFile) { $cookiePlugin = new CookiePlugin(new FileCookieJar($this->_cookieFile)); $client->addSubscriber($cookiePlugin); } $client->setUserAgent("Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.62 Safari/537.36"); switch($this->console) { case "XBOX": $url = "https://utas.fut.ea.com/ut/game/fifa15/transfermarket?"; break; case "PS": $url = "https://utas.s2.fut.ea.com/ut/game/fifa15/transfermarket?"; break; } $searchstring = ""; if ($minbin > 0){ $searchstring .= "&minb=".$minbin; } if ($maxbin > 0){ $searchstring .= "&maxb=".$maxbin; } if ($playerId > 0) { $searchstring .= "&maskedDefId=".$playerId; } $search = $url . "type=player&start=$start&num=$num".$searchstring; $request = $client->post($search); $request->addHeader('Origin', 'http://www.easports.com'); $request->setHeader('Referer', 'http://www.easports.com/iframe/fut/bundles/futweb/web/flash/FifaUltimateTeam.swf'); $request->addHeader('X-HTTP-Method-Override', 'GET'); $request->addHeader('X-UT-Embed-Error', 'true'); $request->addHeader('X-UT-PHISHING-TOKEN', $this->phish); $request->addHeader('X-UT-SID', $this->sess); $response = $request->send(); $json = $response->json(); return $json; } } ?>
( ! ) Warning: file_exists() expects parameter 1 to be a valid path, resource given in C:\wamp\www\Fifa 15 Autobuyer\classes\connector.php on line 31 Call Stack # Time Memory Function Location 1 0.0010 244656 {main}( ) ..\index.php:0 2 0.0200 663832 Connector->Connect( ) ..\index.php:21 3 0.0310 1209384 file_exists ( ) ..\connector.php:31
( ! ) Warning: file_put_contents() expects parameter 1 to be a valid path, resource given in C:\wamp\www\Fifa 15 Autobuyer\classes\connector.php on line 32 Call Stack # Time Memory Function Location 1 0.0010 244656 {main}( ) ..\index.php:0 2 0.0200 663832 Connector->Connect( ) ..\index.php:21 3 0.0320 1209720 file_put_contents ( ) ..\connector.php:32
( ! ) Warning: file_get_contents() expects parameter 1 to be a valid path, resource given in phar://C:/wamp/www/Fifa 15 Autobuyer/classes/Guzzle/guzzle.phar/src/Guzzle/Plugin/Cookie/CookieJar/FileCookieJar.php on line 55 Call Stack # Time Memory Function Location 1 0.0010 244656 {main}( ) ..\index.php:0 2 0.0200 663832 Connector->Connect( ) ..\index.php:21 3 0.0370 1320792 Guzzle\Plugin\Cookie\CookieJar\FileCookieJar->__construct( ) ..\connector.php:34 4 0.0370 1320864 Guzzle\Plugin\Cookie\CookieJar\FileCookieJar->load( ) ..(null):25 5 0.0370 1320912 file_get_contents ( ) ..(null):55
( ! ) Notice: Undefined offset: 1 in C:\wamp\www\Fifa 15 Autobuyer\classes\connector.php on line 84 Call Stack # Time Memory Function Location 1 0.0010 244656 {main}( ) ..\index.php:0 2 0.0200 663832 Connector->Connect( ) ..\index.php:21 3 3.2612 3110544 Connector->GetNucleusId( ) ..\connector.php:40

I'm not sure, the library itself is already part of the project, I didn't think anything needed to be installed.

I just installed composer and ran it in my project directory

composer require guzzlehttp/guzzle

and then added

require 'vendor/autoload.php';

but that didnt change anything

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.