Bitcoin Forum

Bitcoin => Project Development => Topic started by: techansaari on July 11, 2017, 10:50:42 AM



Title: Need php api and example to display all coins prices on my website
Post by: techansaari on July 11, 2017, 10:50:42 AM
Hello,
I am trying to develop my website to display bitcoin and all altcoins prices with volumes from exchanges.
I got all prices from worldcoinindex :
https://www.worldcoinindex.com/apiservice/json?key=hXqCVku1C8NK9UtZjMGBFBJip

it is working fine from localhost (xampp) but when I try it from server it sends to a cloudflare page.

Please suggest what i am doing wrong / missing?

Thanks


Title: Re: Need php api and example to display all coins prices on my website
Post by: mprep on July 11, 2017, 05:42:58 PM
I suggest you edit out your API key. Even though the service is free, you probably wouldn't want to have it revoked in case someone decided to troll you and spam the key with requests.


Title: Re: Need php api and example to display all coins prices on my website
Post by: BilalHIMITE on July 11, 2017, 05:52:27 PM
Hello,
I am trying to develop my website to display bitcoin and all altcoins prices with volumes from exchanges.
I got all prices from worldcoinindex :
https://www.worldcoinindex.com/apiservice/json?key=XXXXXXXXXXXXXXXXXXXXXXXXXXX

it is working fine from localhost (xampp) but when I try it from server it sends to a cloudflare page.

Please suggest what i am doing wrong / missing?

Thanks

What message is on the CloudFlare page?
If it says 'Server Down', then probably the IP is not correct on CloudFlare.
PM me if you want help.


Edit you api key please.


Title: Re: Need php api and example to display all coins prices on my website
Post by: cloverme on July 11, 2017, 08:38:21 PM
Hello,
I am trying to develop my website to display bitcoin and all altcoins prices with volumes from exchanges.
I got all prices from worldcoinindex :
https://www.worldcoinindex.com/apiservice/json?key=

it is working fine from localhost (xampp) but when I try it from server it sends to a cloudflare page.

Please suggest what i am doing wrong / missing?

Thanks

It's probably something in your code as to why you're pulling a cloudflare message or it could be seeing your source IP address as suspect and wanting to do a challenge/response with you. There's a lot of IP address space that's tagged at cloudflare as suspect.

I left out your API key for security reasons, but the code below shows the price of BTC.


Code:
$json_string = 'https://www.worldcoinindex.com/apiservice/json?key=';
$jsondata = file_get_contents($json_string);
$obj = json_decode($jsondata, true);
echo '<pre>';
echo $obj['Markets']['46']['Price_usd'];