Post
Topic
Board Development & Technical Discussion
Topic OP
Api blockchain
by
azaarps
on 18/05/2024, 20:06:44 UTC

The code does not work and Bitcoin addresses are not received. What is the solution to this problem? Can someone solve the problem for me?

/*
 * ----------------------------------------------------------------------------
 * The way to use a simple programming function  : blockchain
 * Submitted by 0x32
 * ----------------------------------------------------------------------------
 */
 
The first step is to submit an order : https://www.blockchain.com/api/request
The second step is to add this code in your design with modification to some things
 * ----------------------------------------------------------------------------*
<?php
$api_key = "api"; /your api
$xpub = "xpub"; /your xpub
$secret = "your_secret"; //this can be anything you want
$rootURL = "your site"; $orderID = uniqid();  /your web site
$callback_url = $rootURL."/callback.php?invoice=".$orderID."&secret=".$secret;
$receive_url = "https://api.blockchain.info/v2/receive?key=".$api_key."&xpub=".$xpub."&callback=".urlencode($callback_url);
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, $receive_url);
$ccc = curl_exec($ch);
$json = json_decode($ccc, true);
$payTo = $json['address'];
echo $payTo; // The API places you where your random address will appear.
?>
 * ----------------------------------------------------------------------------*

/*
 * ----------------------------------------------------------------------------
 * The way to use a simple programming function  : blockchain
 * Submitted by 0x32
 * ----------------------------------------------------------------------------
 */