Last active
October 20, 2019 17:45
-
-
Save josecelano/789eab1ab32bee8464a6 to your computer and use it in GitHub Desktop.
Make First Call PHP File
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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(); | |
} |
Who knows how to fix it please?
Just put "@" symbol before sizeof() to hide these warning messages
Move the first and second conditions
From
} else if (sizeof($v) <= 0 && is_array($v)) {
to the
} else if (is_array($v) && sizeof($v) <= 0) {
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Warning: sizeof(): Parameter must be an array or an object that implements Countable in C:\FILES\XAMPP\htdocs\project\php-client\blockcypher\php-client\lib\BlockCypher\Common\BlockCypherModel.php on line 315
Warning: sizeof(): Parameter must be an array or an object that implements Countable in C:\FILES\XAMPP\htdocs\project\php-client\blockcypher\php-client\lib\BlockCypher\Common\BlockCypherModel.php on line 315
{"error": "API calls limits have been reached. To extend your limits please upgrade your plan on BlockCypher accounts page."}