blocktrail / blocktrail-sdk-php

BlockTrail's Developer Friendly PHP SDK for the BlockTrail API
MIT License
44 stars 49 forks source link

Getting transaction details #116

Open francescopepe opened 6 years ago

francescopepe commented 6 years ago

Ehy there, I'm trying to get transaction details with method ->transaction() but I get UnknownEndpointSpecificError. In the method the client sends 2 different requests to the server, the first one with "?verbose=3" and the second one without it. The first one works but the second one obtains an error 403 with empty body. If I put usleep(100 * 1000) between the 2 requests everything works. It's clearly due to the server endpoint.

What is happening with the server APIs?

n0n0n0n0 commented 6 years ago

It was moved to btc.com and now has TONS OF PROBLEMS.

lacksfish commented 6 years ago

Which version of the SDK are you using? Can you share a code snippet of where in your code you receive the 403?

francescopepe commented 6 years ago

It seems it doesn't happen anymore. Probabily it was related to the migration to btc.com

francescopepe commented 6 years ago

Ehy there! The same error came out again :(

I'm using the SDK 3.2.2. Here's the snippet:

$client = new BlocktrailSDK( "*******","*******"); $transaction = $client->transaction('<id>');

I get this error: image

The error is thrown in blocktrail\blocktrail-sdk\src\BlocktrailSDK.php

I added usleep() below and If I uncomment it no error comes out. image

here there is the response I get debugging it (of course without usleep): image

Thx

n0n0n0n0 commented 6 years ago

Looks like ratelimit on server side

francescopepe commented 6 years ago

It seems so. Who should fix this? xD

n0n0n0n0 commented 6 years ago

i'm waiting for fixes since update, so be patient :D

RishabSwift commented 6 years ago

Any fixes yet? It's almost going to be 2 months.

francescopepe commented 6 years ago

Nothing yet, I always need to put usleep for now.

Glebsky commented 5 years ago

it works for me if public function transaction($txhash) { usleep(150 5000); $response = $this->dataClient->get($this->converter->getUrlForTransaction($txhash)); $res = $this->converter->convertTx($response->body(), null); usleep(150 5000); if ($this->converter instanceof BtccomConverter) { $res['raw'] = \json_decode($this->dataClient->get("tx/{$txhash}/raw")->body(), true)['data']; }

    return $res;
}
n0n0n0n0 commented 5 years ago

it should work w/o usleep

Glebsky commented 5 years ago

since since2 not working for me

francescopepe commented 5 years ago

You have to use usleep for now. It seems it's not fixed yet :(.