Check Bitcoin Balance with mybitx api https GET url

0 votes

I am new to integrating bitcoin API to my PHP page, I have created a bitcoin account with luno, I have created API Key.

I have been given this url to get balance using my generated API Key:

$ curl -u keyid:keysecret https://api.mybitx.com/api/1/balance

Can anybody help with a proper example on how I can use my API with this given url to display my wallet balance on a PHP page?

Sep 12, 2018 in Blockchain by digger
• 27,630 points

retagged Nov 22, 2018 by Priyaj 165 views

2 answers to this question.

0 votes

The easiest way I know to convert curl commands to executable PHP code is to use this site: https://incarnate.github.io/curl-to-php/

Just add your curl command:

curl -u keyid:keysecret https://api.mybitx.com/api/1/balance

to the textbox that says "Paste curl here". Then take the PHP that is output and integrate it into your app.

answered Sep 12, 2018 by slayer
• 29,050 points
0 votes

You can use the PHP Requests library for an easy way to make HTTP Requests. Your curlcommand can be converted as follows:

<?php
    include('vendor/rmccue/requests/library/Requests.php');
    Requests::register_autoloader();
    // Use additional headers if necessary
    $headers = array();
    // Create authorization using key and secret.
    $options = array('auth' => array('keyid', 'keysecret'));
    // Create the GET request to the URL
    $response = Requests::get('https://api.mybitx.com/api/1/balance', $headers, $options);
    // The result is available in $response
?>
answered Sep 17, 2018 by Lalit

Related Questions In Blockchain

0 votes
1 answer

How to get iota balance via api url?

Either run your own node (thus, the localhost reference ...READ MORE

answered Sep 12, 2018 in Blockchain by digger
• 27,630 points
101 views
0 votes
1 answer

How can I simulate private bitcoin network with random peer discovery?

You can model the whatever network you ...READ MORE

answered May 28, 2018 in Blockchain by Johnathon
• 9,080 points
43 views
0 votes
1 answer

jQuery/ajax - two separate API requests with combined results

You can move the second ajax call ...READ MORE

answered Jun 19, 2018 in Blockchain by ariaholic
• 7,340 points
37 views
0 votes
1 answer

How to check Bitcoin Wallet ?

This can be done using Extended Public ...READ MORE

answered Jul 13, 2018 in Blockchain by Perry
• 17,020 points
82 views
+1 vote
3 answers

Removing double quotes from a string from JSON response in PHP

Just remove the json_encode call, and it should work: $resp ...READ MORE

answered Sep 12, 2018 in Blockchain by digger
• 27,630 points
2,920 views
0 votes
1 answer
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
138 views
0 votes
2 answers

How to check if bitcoin address is valid?

For Java, have a look at the ...READ MORE

answered Aug 20, 2018 in Blockchain by Omkar
• 67,380 points
285 views
0 votes
1 answer

How to open bitcoin-qt wallet with bitcoinj?

I found this issue solved at the ...READ MORE

answered Aug 24, 2018 in Blockchain by slayer
• 29,050 points
57 views