-
-
Save josecelano/789eab1ab32bee8464a6 to your computer and use it in GitHub Desktop.
| <?php | |
| // 1. Autoload the SDK Package. This will include all the files and classes to your autoloader | |
| require __DIR__ . '/php-client/autoload.php'; | |
| // 2. Provide your Token. Replace the given one with your app Token | |
| // https://accounts.blockcypher.com/dashboard | |
| $token = 'c0afcccdde5081d6429de37d16166ead'; | |
| $apiContext = new \BlockCypher\Rest\ApiContext( | |
| new \BlockCypher\Auth\SimpleTokenCredential($token) | |
| ); | |
| // 3. Lets try to create a new webhook using WebHook API mentioned here | |
| // http://dev.blockcypher.com/#webhooks | |
| $webHook = new \BlockCypher\Api\WebHook(); | |
| $webHook->setUrl("https://requestb.in/slmm49sl?uniqid=" . uniqid()); | |
| $webHook->setEvent('unconfirmed-tx'); | |
| // 4. Make a Create Call and Print the Card | |
| try { | |
| $webHook->create($apiContext); | |
| echo $webHook; | |
| } | |
| catch (\BlockCypher\Exception\BlockCypherConnectionException $ex) { | |
| // This will print the detailed information on the exception. | |
| //REALLY HELPFUL FOR DEBUGGING | |
| echo $ex->getData(); | |
| } |
PHP Fatal error: Uncaught TypeError: sizeof(): Argument #1 ($value) must be of type Countable|array, string given in C:\Users\rezau\Downloads\test\vendor\blockcypher\php-client\lib\BlockCypher\Common\BlockCypherModel.php:296 Stack trace: #0 C:\Users\rezau\Downloads\test\vendor\blockcypher\php-client\lib\BlockCypher\Common\BlockCypherModel.php(296): sizeof('https://request...') #1 C:\Users\rezau\Downloads\test\vendor\blockcypher\php-client\lib\BlockCypher\Common\BlockCypherModel.php(281): BlockCypher\Common\BlockCypherModel->_convertToArray(Array) #2 C:\Users\rezau\Downloads\test\vendor\blockcypher\php-client\lib\BlockCypher\Common\BlockCypherModel.php(268): BlockCypher\Common\BlockCypherModel->toArray() #3 C:\Users\rezau\Downloads\test\vendor\blockcypher\php-client\lib\BlockCypher\Api\WebHook.php(146): BlockCypher\Common\BlockCypherModel->toJSON() #4 C:\Users\rezau\Downloads\test\first.php(22): BlockCypher\Api\WebHook->create(Object(BlockCypher\Rest\ApiContext)) #5 {main} thrown in C:\Users\rezau\Downloads\test\vendor\blockcypher\php-client\lib\BlockCypher\Common\BlockCypherModel.php on line 296
Fatal error: Uncaught TypeError: sizeof(): Argument #1 ($value) must be of type Countable|array, string given in C:\Users\rezau\Downloads\test\vendor\blockcypher\php-client\lib\BlockCypher\Common\BlockCypherModel.php:296 Stack trace: #0 C:\Users\rezau\Downloads\test\vendor\blockcypher\php-client\lib\BlockCypher\Common\BlockCypherModel.php(296): sizeof('https://request...') #1 C:\Users\rezau\Downloads\test\vendor\blockcypher\php-client\lib\BlockCypher\Common\BlockCypherModel.php(281): BlockCypher\Common\BlockCypherModel->_convertToArray(Array) #2 C:\Users\rezau\Downloads\test\vendor\blockcypher\php-client\lib\BlockCypher\Common\BlockCypherModel.php(268): BlockCypher\Common\BlockCypherModel->toArray() #3 C:\Users\rezau\Downloads\test\vendor\blockcypher\php-client\lib\BlockCypher\Api\WebHook.php(146): BlockCypher\Common\BlockCypherModel->toJSON() #4 C:\Users\rezau\Downloads\test\first.php(22): BlockCypher\Api\WebHook->create(Object(BlockCypher\Rest\ApiContext)) #5 {main} thrown in C:\Users\rezau\Downloads\test\vendor\blockcypher\php-client\lib\BlockCypher\Common\BlockCypherModel.php on line 296
Hi @rzw-gh this is an ancient code.
The PHP client was even archived https://github.com/blockcypher/php-client in 2020
PHP Fatal error: Uncaught TypeError: sizeof(): Argument #1 ($value) must be of type Countable|array, string given in C:\Users\rezau\Downloads\test\vendor\blockcypher\php-client\lib\BlockCypher\Common\BlockCypherModel.php:296
Stack trace:
#0 C:\Users\rezau\Downloads\test\vendor\blockcypher\php-client\lib\BlockCypher\Common\BlockCypherModel.php(296): sizeof('https://request...')
#1 C:\Users\rezau\Downloads\test\vendor\blockcypher\php-client\lib\BlockCypher\Common\BlockCypherModel.php(281): BlockCypher\Common\BlockCypherModel->_convertToArray(Array)
#2 C:\Users\rezau\Downloads\test\vendor\blockcypher\php-client\lib\BlockCypher\Common\BlockCypherModel.php(268): BlockCypher\Common\BlockCypherModel->toArray()
#3 C:\Users\rezau\Downloads\test\vendor\blockcypher\php-client\lib\BlockCypher\Api\WebHook.php(146): BlockCypher\Common\BlockCypherModel->toJSON()
#4 C:\Users\rezau\Downloads\test\first.php(22): BlockCypher\Api\WebHook->create(Object(BlockCypher\Rest\ApiContext))
#5 {main}
thrown in C:\Users\rezau\Downloads\test\vendor\blockcypher\php-client\lib\BlockCypher\Common\BlockCypherModel.php on line 296
Fatal error: Uncaught TypeError: sizeof(): Argument #1 ($value) must be of type Countable|array, string given in C:\Users\rezau\Downloads\test\vendor\blockcypher\php-client\lib\BlockCypher\Common\BlockCypherModel.php:296
Stack trace:
#0 C:\Users\rezau\Downloads\test\vendor\blockcypher\php-client\lib\BlockCypher\Common\BlockCypherModel.php(296): sizeof('https://request...')
#1 C:\Users\rezau\Downloads\test\vendor\blockcypher\php-client\lib\BlockCypher\Common\BlockCypherModel.php(281): BlockCypher\Common\BlockCypherModel->_convertToArray(Array)
#2 C:\Users\rezau\Downloads\test\vendor\blockcypher\php-client\lib\BlockCypher\Common\BlockCypherModel.php(268): BlockCypher\Common\BlockCypherModel->toArray()
#3 C:\Users\rezau\Downloads\test\vendor\blockcypher\php-client\lib\BlockCypher\Api\WebHook.php(146): BlockCypher\Common\BlockCypherModel->toJSON()
#4 C:\Users\rezau\Downloads\test\first.php(22): BlockCypher\Api\WebHook->create(Object(BlockCypher\Rest\ApiContext))
#5 {main}
thrown in C:\Users\rezau\Downloads\test\vendor\blockcypher\php-client\lib\BlockCypher\Common\BlockCypherModel.php on line 296