🐱apikey配置
以下是apikey的调整的地方,不做这个调整,程序也可以正常跑,只是后面量大了可能有限制,官方文档
申请地址:https://www.trongrid.io/
vendor/fenguoz/tron-php/src/Api.php
这个文件下面的post方法替换成下面的方法,其实就是加了一个 headers
参数 ,对应的 TRON-PRO-API-KEY
的值填入你自己的apikey值即可
/**
* Abstracts some common functionality like formatting the post data
* along with error handling.
*
* @throws TronErrorException
*/
public function post(string $endpoint, array $data = [], bool $returnAssoc = false)
{
if (sizeof($data)) {
$data = [
'headers' => [
'TRON-PRO-API-KEY' => 'your api key'
],
'json' => $data
];
}
$stream = (string)$this->getClient()->post($endpoint, $data)->getBody();
$body = json_decode($stream, $returnAssoc);
$this->checkForErrorResponse($returnAssoc, $body);
return $body;
}
Last updated