PHP code example of looptribe / paytoshi-library-php

1. Go to this page and download the library: Download looptribe/paytoshi-library-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

looptribe / paytoshi-library-php example snippets


composer.phar 
 php


$browser = new \Buzz\Browser();
$paytoshi = new \Looptribe\Paytoshi\Api\PaytoshiApi($browser, 'http://paytoshi.org/api/v1/');
 php


$browser = new \Buzz\Browser(new \Buzz\Client\Curl());
$paytoshi = new Looptribe\Paytoshi\Api\PaytoshiApi($browser, 'http://paytoshi.org/api/v1/');
 php


// Set 10 seconds of timeout
$browser->getClient()->setTimeout(10);
 php

// Create the $paytoshi object as explained in the previous section
...

// Create a new payout
$result = $paytoshi->send(
    'a8p9uevhfgx7ewt1kf09v2n3kfhzkeyxi8ywcehfqnl9is30gq', //Faucet Api key
    '1EhNaUFaVW99in6drLeD8ygrLicAcf8rAc', //Bitcoin address
    100, //Amount
    '127.0.0.1' //Recipient ip
);

// Create a referral payout
$result = $paytoshi->send(
    'a8p9uevhfgx7ewt1kf09v2n3kfhzkeyxi8ywcehfqnl9is30gq',  //Faucet Api key
    '18aWoXRJRTfK8ZdxH9Y8qW3Q3AKPqra2DlyO',  //Bitcoin address
    100, //Amount
    '127.0.0.1', //Recipient ip
    true //Referral flag
);
 php
// Check balance
$result = $paytoshi->getBalance(
    'a8p9uevhfgx7ewt1kf09v2n3kfhzkeyxi8ywcehfqnl9is30gq'  //Faucet Api key
);

// Your balance in satoshi
$balance = $result->getAvailableBalance();