jaggedsoft / php-binance-api

PHP Binance API is an asynchronous PHP library for the Binance API designed to be easy to use. https://github.com/binance-exchange/php-binance-api
MIT License
605 stars 497 forks source link

dude: Get Response Headers #454

Closed marcoas closed 2 years ago

marcoas commented 2 years ago

(Translated by Google)

Hello. How to access HTTP headers from API response?

ePascalC commented 2 years ago

@marcoas

$candles = $api->candlesticks("BTCUSDT", "1h");
print_r($api->lastRequest['header']);
print_r($api->xMbxUsedWeight);

After you run any command (like get candlesticks) you could ask for the 'lastRequest' and from that array take the 'header' subarray. If you just want the used Weight so far, you could also check xMbxUsedWeight

Hope this helps.

marcoas commented 2 years ago

Excellent