申请地址:https://www.trongrid.io/
/**
* 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;
}