Skip to content

Instantly share code, notes, and snippets.

@josecelano
Last active August 29, 2015 14:20
Show Gist options
  • Save josecelano/ed71ee7a4c3b156bd99c to your computer and use it in GitHub Desktop.
Save josecelano/ed71ee7a4c3b156bd99c to your computer and use it in GitHub Desktop.
Adding File based SDK Configurations
<?php
// 1. Autoload the SDK Package. This will include all the files and classes to your autoloader
//require __DIR__ . '/php-client/autoload.php'; // Direct Donwload
require __DIR__ . '/vendor/autoload.php'; // Using Composer
// 2. Define BC_CONFIG_PATH directory
if(!defined("BC_CONFIG_PATH")) {
define("BC_CONFIG_PATH", __DIR__);
}
// After Step 2
$webHook = new \BlockCypher\Api\WebHook();
$webHook->setUrl("https://requestb.in/slmm49sl?uniqid=" . uniqid());
$webHook->setEvent('unconfirmed-tx');
// After Step 3
// 4. Make a Create Call and Print the WebHook
try {
$webHook->create($apiContext);
echo $webHook;
}
catch (\BlockCypher\Exception\BlockCypherConnectionException $ex) {
echo $ex;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment