Created
October 14, 2021 13:28
-
-
Save AdityaEXP/27408bd361d5b8fcc9ac2bf459eb5303 to your computer and use it in GitHub Desktop.
Send bitcoin from your coinbase email to another person email by php.
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 | |
function sendTransaction($private_key, $api_key , $to_email , $amount , $currency, $URL, $account_id){ | |
$json = new stdClass(); | |
$json->method = "POST"; | |
$json->path = "/v2/accounts/".$account_id."/transactions"; | |
$json->secretapikey = $private_key; | |
$json->apikey = $api_key; | |
$body = new stdClass(); | |
$body->type = "send"; | |
$body->to = $to_email; | |
$body->amount = $amount; | |
$body->currency = $currency; | |
$result = json_encode($json); | |
$body = json_encode($body); | |
$time= time(); | |
$sign = $time.$json->method.$json->path.$body; | |
$hmac = hash_hmac("SHA256", $sign, $json->secretapikey); | |
$header = array( | |
"CB-ACCESS-KEY:".$api_key, | |
"CB-ACCESS-SIGN:".$hmac, | |
"CB-ACCESS-TIMESTAMP:".time(), | |
"CB-VERSION:2019-11-15", | |
"Content-Type:application/json" | |
); | |
$ch = curl_init($URL); | |
curl_setopt($ch, CURLOPT_POSTFIELDS, $body); | |
curl_setopt($ch, CURLOPT_HTTPHEADER,$header); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
$result = curl_exec($ch); | |
curl_close($ch); | |
return $result; | |
}; | |
//Creating URL For Sending Request | |
$account_id = '8fde3e0a-xxxxxxx'; //Coinbase Account ID | |
$private_key = 'Doadlraixxxxxx'; //Coinbase Private Key | |
$api_key = 'ysEZjjBxxxxx'; //Coinbase API KEY | |
$to_email = 'xxxxx@gmail.com'; //Reciver Email | |
$amount = 0.000001; //Amount To Send | |
$currency = 'BTC'; //Crypto To Send | |
$url = "https://api.coinbase.com/v2/accounts/".$account_id."/transactions"; | |
$tranx_id = sendTransaction( | |
$private_key, | |
$api_key, | |
$to_email, | |
$amount, | |
$currency, | |
$url, | |
$account_id | |
); | |
print_r($tranx_id); | |
?> |
Please someone reply me.
@MrBrightside11 can you please tell me how to get the account id mentioned in url of code:
$url = "https://api.coinbase.com/v2/accounts/".$account_id."/transactions";
its urgent please.
@MrBrightside11 can you please tell me how to get the account id mentioned in url of code:
$url = "https://api.coinbase.com/v2/accounts/".$account_id."/transactions";
its urgent please.
Click https://www.coinbase.com/home
Screenrecording_20220714_154019.mp4
When you log into Coinbase, find the coin you want, then click on "Wallet". If you look at the URL at the top of the page, you can see the account ID there. It is what is after the accounts/ . It works this way for all coins. You can see my account ID for Bitcoin Cash below. 9e1030...... all of that is the ID.
On Thursday, July 14, 2022 at 10:42:42 AM EDT, Jobians Techie ***@***.***> wrote:
@Jobians commented on this gist.
@MrBrightside11 can you please tell me how to get the account id mentioned in url of code:
$url = "https://api.coinbase.com/v2/accounts/".$account_id."/transactions";
its urgent please.
Click https://www.coinbase.com/home
https://user-images.githubusercontent.com/88005779/179009218-0b1601f1-0ab0-4087-8406-dc1c598cc5b9.mp4
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: ***@***.***>
How to check transaction status in php using api
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
i am getting problem while sending money through this code and getting error message.
{"errors":[{"id":"not_found","message":"Not found"}]}
Can someone plz guide me how i can get the account id from coinbase account please its urgent.??