JKetelaar/PHP-FUT-API

unexpected '.', expecting '

Closed this issue · 16 comments

I got this error:
Parse error: syntax error, unexpected '.', expecting ')
On this line:
/src/JKetelaar/fut/api/API.php on line 118

How to fix it?

I cannot reproduce this error, is there a bigger exception log or do you have the example code you're trying to execute?

Closed due to no response.

Sorry had no time to respond. Still got the error!

Please provide the entire stack trace.

New error!

Fatal error: Uncaught JKetelaar\fut\api\errors\login\MainLogin: Unable to login with unknown response With the following message: Incorrect verification code With error code: 295712 in /home4/tonikuipers/public_html/mydomain.com/src/JKetelaar/fut/api/user/Login.php:396 Stack trace: #0 /home4/tonikuipers/public_html/mydomain.com/src/JKetelaar/fut/api/user/Login.php(98): JKetelaar\fut\api\user\Login->postTwoFactorForm('https://signin....') #1 /home4/tonikuipers/public_html/mydomain.com/src/JKetelaar/fut/api/API.php(123): JKetelaar\fut\api\user\Login->login() #2 /home4/tonikuipers/public_html/mydomain.com/index.php(11): JKetelaar\fut\api\API->login() #3 {main} thrown in /home4/tonikuipers/public_html/mydomain.com/src/JKetelaar/fut/api/user/Login.php on line 396

Update: I received the verification code by mail and used the example form README.md

The verification code provided is incorrect

Where should i provide that verification code?

Within the method that returns the code, as a parameter for the login class.

So it should be like this?

function totp_callback() {
    return 'MY_MAIL_CODE';
}

Yes

Still not working. I'am using this code as my index php.

<?php
require_once('vendor/autoload.php');

define('DATA_DIR', __DIR__ . '/data/');

$api = new \JKetelaar\fut\api\API('my_mail', 'my_pass', 'secret_answer', 'totp_callback (not changed)', 'ps4', true);

if($api->login() === true) {
    echo('We\'re logged in!' . "\n");

    $handler = $api->getHandler();
    foreach($handler->getTradepile() as $trade) {
        // Interact with $trade here
    }
}

function totp_callback() {
    return 'my_mail_code';
}

This is the error.

Fatal error: Uncaught JKetelaar\fut\api\errors\login\MainLogin: Unable to login with unknown response With the following message: Incorrect verification code With error code: 295712 in /home4/tonikuipers/public_html/mydomain.com/src/JKetelaar/fut/api/user/Login.php:396 Stack trace: #0 /home4/tonikuipers/public_html/mydomain.com/src/JKetelaar/fut/api/user/Login.php(98): JKetelaar\fut\api\user\Login->postTwoFactorForm('https://signin....') #1 /home4/tonikuipers/public_html/mydomain.com/src/JKetelaar/fut/api/API.php(123): JKetelaar\fut\api\user\Login->login() #2 /home4/tonikuipers/public_html/mydomain.com/index.php(11): JKetelaar\fut\api\API->login() #3 {main} thrown in /home4/tonikuipers/public_html/mydomain.com/src/JKetelaar/fut/api/user/Login.php on line 396

If i try to login with a Backup code it's giving me another error. But the backup code is used in the Customer portal of EA.

This is the error.

Fatal error: Uncaught JKetelaar\fut\api\errors\login\MainLogin: Unable to login with unknown response With the following message: HTTP/1.1 500 Internal Server Error With error code: 500 in /home4/tonikuipers/public_html/mydomain.com/src/JKetelaar/fut/api/user/Login.php:210 Stack trace: #0 /home4/tonikuipers/public_html/mydomain.com/src/JKetelaar/fut/api/user/Login.php(185): JKetelaar\fut\api\user\Login->getAccountInformation() #1 /home4/tonikuipers/public_html/mydomain.com/src/JKetelaar/fut/api/user/Login.php(146): JKetelaar\fut\api\user\Login->getShards('0') #2 /home4/tonikuipers/public_html/mydomain.com/src/JKetelaar/fut/api/user/Login.php(392): JKetelaar\fut\api\user\Login->getFUTPage() #3 /home4/tonikuipers/public_html/mydomain.com/src/JKetelaar/fut/api/user/Login.php(98): JKetelaar\fut\api\user\Login->postTwoFactorForm('https://signin....') #4 /home4/tonikuipers/public_html/mydomain.com/src/JKetelaar/fut/api/API.php(123): JKetelaar\fut\api\user\Login->login() #5 /home4/tonikuipers/public_html/mydomain.com/login.php(18): JKetelaar\fut\api\API->login() in /home4/tonikuipers/public_html/mydomain.com/src/JKetelaar/fut/api/user/Login.php on line 210

Fatal error: Uncaught JKetelaar\fut\api\errors\login\MainLogin: Unable to login with unknown response With the following message: Incorrect verification code With error code: 295712

With the following message: Incorrect verification code

Seems like either a wrong code or a wrong piece of code.
Could you provide your login staging method, to see we could trace this down?

I'am trying to use email verification. But now i switched to Authenticator and it's working fine. (still want to use email verification or backupcodes).

An other quenstion, how to (echo) display the current amount of coins on the account when i logged in? Could you give me any example?

The Market class has a method getCredits which returns the amount of credits/coins on the account

I'll try to use email verification as a test soon, to see if that works properly.

Thanks!