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?phpapibitcoin
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 -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.
You can use the PHP Requests library for an easy way to make HTTP Requests. Your
curl command 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 ?>