Bitcoin Forum

Economy => Service Discussion => Topic started by: ABitBack on April 17, 2014, 11:19:49 AM



Title: Blockchain 'DDoS protection by CloudFlare' has messed a project up. Small reward
Post by: ABitBack on April 17, 2014, 11:19:49 AM
So I have this code

Code:
try{	
$data = file_get_contents("http://blockchain.info/q/addressbalance/".FAUCETADDRESS."");
}catch(Exception $e){
echo "Error getting the balance.";
}

The problem is my script cannot get the result in real time now due to cloudflare and I get this error:

Warning: file_get_contents(http://blockchain.info/q/addressbalance/*ADDRESS*): failed to open stream: HTTP request failed! HTTP/1.1 503 Service Temporarily Unavailable

Any work around would be very much appreciated. $5 in bitcoin/pp for a quick fix.

Upon reading, this will only be temporary? just until the ddosing has stopped?


Title: Re: Blockchain 'DDoS protection by CloudFlare' has messed a project up. Small reward
Post by: OnkelPaul on April 17, 2014, 11:23:43 AM
You're probably fetching the info too often.
You could either cache the result of each call and do the actual call at most once per minute, or you could (preferrably IMO) run your own bitcoin node that you can query as often as you like.

I suppose you're trying to query the balances of addresses that you don't own, right?

Onkel Paul


Title: Re: Blockchain 'DDoS protection by CloudFlare' has messed a project up. Small reward
Post by: enriquez on April 17, 2014, 05:26:52 PM
I have the same issue. My app stopped working as well.

We're not doing anything wrong, they changed something on their end. I'm trying to get in contact with them, but haven't heard back yet.


Title: Re: Blockchain 'DDoS protection by CloudFlare' has messed a project up. Small reward
Post by: enriquez on April 17, 2014, 05:34:45 PM
...and it's back.

It's probably a good time to investigate other options or fallbacks. I've been keeping an eye on https://helloblock.io. I would run my own node, but I wanted to keep my costs down.


Title: Re: Blockchain 'DDoS protection by CloudFlare' has messed a project up. Small reward
Post by: 1000000 on April 17, 2014, 06:23:23 PM
If you still need a quick fix you can switch to blockr.io as a temporary solution:

Code:
<?php
try{
$stream json_decode(file_get_contents("http://btc.blockr.io/api/v1/address/balance/".FAUCETADDRESS.""),true);
$data $stream['data']['balance']*100000000;  
}catch(Exception $e){
echo "Error getting the balance.";
}
?>