HomeХобби и стильRelated VideosMore From: m1xolyd1an

Lesson 3 - So You Want To Use Bitcoin On Your Website?

10 ratings | 2170 views
An intro to PHP and parsing JSON to get bitcoin market data for your website. http://btcthreads.com/lesson3.html 1J9ikqFuwrzPbczsDkquA9uVYeq6dEehsj
Html code for embedding videos on your blog
Text Comments (7)
Crypto Cannibal (1 year ago)
Great explanation of code without being too lengthy in the explanation
ramesh kumar (1 year ago)
Hi man how exactly can i display the price in the header(menu bar) on a website
Julien Morand (3 years ago)
I am running the php file on a local XAMPP server. With your code, I kept having a problem with SSL: Warning: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed in [...] I got it to work with the following code: $url = "https://btc-e.com/api/3/ticker/btc_usd"; $arrContextOptions=array(     "ssl"=>array(         "verify_peer"=>false,         "verify_peer_name"=>false,     ), ); $json = json_decode(file_get_contents($url, true, stream_context_create($arrContextOptions)), true); $price = $json["btc_usd"]["last"]; echo $price;
Julien Morand (3 years ago)
+m1xolyd1an Just got it fixed. Apparently, the problem is that there is a new verify-by-default policy in PHP 5.6. I downgraded XAMPP for it to run PHP 5.5.24. Cheers!
m1xolyd1an (3 years ago)
+Julien Morand I don't know why you would be getting an SSL error when running xampp and then executing the PHP in your browser as: localhost/myphp.php It still works for me on xampp with my code without having to do the verify_peer->false http://btcthreads.com/display-the-exchange-rate-on-your-website/
Anderson Juhasc (4 years ago)
Using print_r($ json); and a html tag <pre> can help you understand better. I use a browser plugin to format the json too: https://addons.mozilla.org/pt-br/firefox/addon/jsonview/
m1xolyd1an (4 years ago)
Thanks for the link, that tool looks helpful.

Would you like to comment?

Join YouTube for a free account, or sign in if you are already a member.