Skip to content
This repository was archived by the owner on Oct 30, 2023. It is now read-only.

Commit d731b6b

Browse files
author
Jon Eyrick
authored
Merge from development
2 parents b331781 + 09a90b8 commit d731b6b

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
# PHP Binance API
1515
This project is designed to help you make your own projects that interact with the [Binance API](https://github.com/binance-exchange/binance-official-api-docs). You can stream candlestick chart data, market depth, or use other advanced features such as setting stop losses and iceberg orders. This project seeks to have complete API coverage including WebSockets.
1616

17-
> Special thank you to all contributors: **dmzoneill, dxjones, jokaorgua,** and others!! *This package needs help from the community.* Improvements contributed to this project are encouraged, and you will be given full credit for changes. All pull requests welcome.
18-
1917
#### Installation
2018
```
2119
composer require "jaggedsoft/php-binance-api @dev"
@@ -1395,3 +1393,7 @@ $api->getTransfered();
13951393
### Documentation
13961394
> There are also numerous other formats available here:
13971395
https://github.com/jaggedsoft/php-binance-api/tree/gh-pages
1396+
1397+
1398+
> # ⚠️ Binance no longer offers support for API projects.
1399+
> ## No support is offered. No questions will be answered.

examples/asset.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
require '../php-binance-api.php';
3+
// @see home_directory_config.php
4+
// use config from ~/.confg/jaggedsoft/php-binance-api.json
5+
$api = new Binance\API();
6+
$asset = $api->assetDetail();
7+
print_r($asset);

php-binance-api.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,11 @@ public function exchangeInfo()
504504
{
505505
return $this->httpRequest("v1/exchangeInfo");
506506
}
507+
508+
public function assetDetail() {
509+
$params["wapi"] = true;
510+
return $this -> httpRequest("v3/assetDetail.html", 'GET', $params, true);
511+
}
507512

508513
/**
509514
* withdraw requests a asset be withdrawn from binance to another wallet
@@ -876,7 +881,10 @@ private function httpRequest(string $url, string $method = "GET", array $params
876881
}
877882
$query = http_build_query($params, '', '&');
878883
$signature = hash_hmac('sha256', $query, $this->api_secret);
879-
$endpoint = $base . $url . '?' . $query . '&signature=' . $signature;
884+
if ($method === "POST") {
885+
$endpoint = $base . $url . '?' . 'signature=' . $signature;
886+
} else
887+
$endpoint = $base . $url . '?' . $query . '&signature=' . $signature;
880888
curl_setopt($curl, CURLOPT_URL, $endpoint);
881889
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
882890
'X-MBX-APIKEY: ' . $this->api_key,
@@ -897,7 +905,7 @@ private function httpRequest(string $url, string $method = "GET", array $params
897905
// Post and postfields
898906
if ($method === "POST") {
899907
curl_setopt($curl, CURLOPT_POST, true);
900-
// curl_setopt($curlch, CURLOPT_POSTFIELDS, $query);
908+
curl_setopt($curl, CURLOPT_POSTFIELDS, $query);
901909
}
902910
// Delete Method
903911
if ($method === "DELETE") {

0 commit comments

Comments
 (0)