Skip to content

userData: Uncaught Error: Function name must be a string #229

@Marc008

Description

@Marc008

Hello,

I plan to add the userData function, but following the example from the doc, I got this error:

PHP Fatal error: Uncaught Error: Function name must be a string in /project/vendor/jaggedsoft/php-binance-api/php-binance-api.php:2094
Stack trace:
#0 /project/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php(123): Binance\API->Binance{closure}(Object(Ratchet\RFC6455\Messaging\Message), Object(Ratchet\Client\WebSocket))
#1 /project/vendor/ratchet/pawl/src/WebSocket.php(72): Ratchet\Client\WebSocket->emit('message', Array)
#2 /project/vendor/ratchet/rfc6455/src/Messaging/MessageBuffer.php(104): Ratchet\Client\WebSocket->Ratchet\Client{closure}(Object(Ratchet\RFC6455\Messaging\Message))
#3 /project/vendor/ratchet/rfc6455/src/Messaging/MessageBuffer.php(60): Ratchet\RFC6455\Messaging\MessageBuffer->processData('\x81~\x1Ed{"e":"outbo...')
#4 /project/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php(123): Ratchet\RFC6455\Messaging\MessageBuffer->onData('\x81~\ in /project/vendor/jaggedsoft/php-binance-api/php-binance-api.php on line 2094

My code is:

$Binance = new Binance\API($key, $secret);

try {
    $Binance->userData($balance_update, $order_update);
} catch (Exception $e) {
    print_r($e->getMessage());
}

$balance_update = function($api, $balances) {
    print_r($balances);
    echo "Balance update".PHP_EOL;
};

$order_update = function($api, $report) {
    echo "Order update".PHP_EOL;
    print_r($report);
};

Platform:

  • Linux 4.9.0-8-amd64 Wrong issue... #1 SMP Debian 4.9.130-2 (2018-10-27) x86_64 GNU/Linux

php version:

  • PHP 7.0.33-0+deb9u1 (cli) (built: Dec 7 2018 11:36:49) ( NTS )

Any idea what could I be doing wrong?

Thanks in advance.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions