Title: Need coinhive code examples (php) Post by: philwire on November 05, 2017, 01:26:40 PM Hi everyone,
I just discovered coinhive and wanted to fiddle with it with a personal lamp server in a virtual machine for testing purposes. Coinhive's documentation is pretty limited and real life makes it that I often have to interrupt my coding & testing sessions. However I've been lurking and reading in the cryptocurrency for about 2 years and I would like to have a small and unique faucet project. Up to now, my web skills are pretty limited to installing WordPress scripts and moving mysql data around with php. I want to get to the next level of web integration, and with good examples I can learn quickly. Basically I'm trying to tell my php machine to fetch the json data and display it to the screen. Then, later on I would like to store the json data in a mysql database so I could show some stats. But up to now, all I get is either blank pages or http 500 errors. Even just making a simple console to graph the data is overwhelming. btw, do I need to have a https certificate to fetch https urls? That shows how much behind I feel like :P While searching, I landed on beniamino38's hivefaucet wich was exactly the general idea I had in mind, except with a few variances like rewarding with more coins than btc or monero. I also thought of some forum "like" or "up" button that would hash a little before accepting, therefore showing a true value of encouragement to the poster (since the liker spent some cpu cycles for him/her), then sharing something like 1/3 to the poster, the liker and the hoster. But again, usable examples are lacking, so useable examples would help me a lot. I'll make sure to share my creation asap :) Title: Re: Need coinhive code examples (php) Post by: BitBustah on November 05, 2017, 01:50:09 PM Share your code and I'll take a look at it.
Title: Re: Need coinhive code examples (php) Post by: philwire on November 06, 2017, 12:07:02 AM Hi, thanks for your reply. Here's my starting code, just to be able to handle a json string from php:
Code: <?php This shoots out a http error 500 on my box. Any help appreciated. Title: Re: Need coinhive code examples (php) Post by: MrFatoni on November 06, 2017, 03:17:35 AM Hi, thanks for your reply. Here's my starting code, just to be able to handle a json string from php: Code: <?php This shoots out a http error 500 on my box. Any help appreciated. try change php://api.coinhive.com to https://api.coinhive.com Title: Re: Need coinhive code examples (php) Post by: philwire on November 06, 2017, 03:29:48 AM Alright, now it gives a blank page. However if I check the source it printed a few <br>'s so this might mean progress
Title: Re: Need coinhive code examples (php) Post by: philwire on November 06, 2017, 03:58:01 AM Alright i finally got it by fiddling with some php answers over the net. For future reference, here's how to show a name and balance of a user:
Code: <?php Cheers! :) |