dozerz (OP)
Legendary
Offline
Activity: 2215
Merit: 1057
|
|
December 17, 2014, 06:01:56 AM |
|
the following code was working to retrieve the usd price, now for some reason its not <?php require 'Mysql.php'; require 'Util.php'; $file = file_get_contents(" http://blockchain.info/ticker"); $vars = json_decode($file, true); $usd = $vars['USD']['15m']; $net_usd = number_format((($usd) * (100 - Settings::fee)) / 100, 2); echo $net_usd returns zero when should be the price. offering 0.1 btc to someone who can fix.
|
space for rent, shilling for sats
|
|
|
|
|
|
|
|
You can see the statistics of your reports to moderators on the "Report to moderator" pages.
|
|
|
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
|
PotatoPie
Member
Offline
Activity: 97
Merit: 10
|
|
December 17, 2014, 06:12:13 AM |
|
That code does work, it seems to be your server with the issue unless Settings::fee is 100 or cannot be found. Try require 'Mysql.php'; require 'Util.php'; $file = file_get_contents("http://blockchain.info/ticker"); $vars = json_decode($file, true); $usd = $vars['USD']['15m']; echo $usd; $net_usd = number_format((($usd) * (100 - Settings::fee)) / 100, 2); See what that returns. If it doesn't return the correct value, then your server is unable to connect to the blockchain ticker.
|
BTC Address: 13mUzcjYysbgNWstbasJ3PVkPB2nCUEqFg
|
|
|
lewellyn
Newbie
Offline
Activity: 26
Merit: 0
|
|
December 17, 2014, 06:16:57 AM |
|
the following code was working to retrieve the usd price, now for some reason its not <?php require 'Mysql.php'; require 'Util.php'; $file = file_get_contents(" http://blockchain.info/ticker"); $vars = json_decode($file, true); $usd = $vars['USD']['15m']; $net_usd = number_format((($usd) * (100 - Settings::fee)) / 100, 2); echo $net_usd returns zero when should be the price. offering 0.1 btc to someone who can fix. You left out where Settings::fee is coming from. If the class Settings isn't found, you'd get a fatal error. The fact that you aren't indicates that it's mis-defined somewhere. You'll need to either post more code, or do digging with that lead yourself.
|
|
|
|
ebx
Newbie
Offline
Activity: 27
Merit: 0
|
|
December 17, 2014, 06:17:47 AM |
|
the following code was working to retrieve the usd price, now for some reason its not <?php require 'Mysql.php'; require 'Util.php'; $file = file_get_contents(" http://blockchain.info/ticker"); $vars = json_decode($file, true); $usd = $vars['USD']['15m']; $net_usd = number_format((($usd) * (100 - Settings::fee)) / 100, 2); echo $net_usd returns zero when should be the price. offering 0.1 btc to someone who can fix. Try changing the url in file_get_contents to be https:// $file = file_get_contents("https://blockchain.info/ticker"); Blockchain.info recently changed some things around, and maybe you're not getting the file through redirect.
|
|
|
|
PotatoPie
Member
Offline
Activity: 97
Merit: 10
|
|
December 17, 2014, 06:24:17 AM |
|
the following code was working to retrieve the usd price, now for some reason its not <?php require 'Mysql.php'; require 'Util.php'; $file = file_get_contents(" http://blockchain.info/ticker"); $vars = json_decode($file, true); $usd = $vars['USD']['15m']; $net_usd = number_format((($usd) * (100 - Settings::fee)) / 100, 2); echo $net_usd returns zero when should be the price. offering 0.1 btc to someone who can fix. You left out where Settings::fee is coming from. If the class Settings isn't found, you'd get a fatal error. The fact that you aren't indicates that it's mis-defined somewhere. You'll need to either post more code, or do digging with that lead yourself. Probably in Util.php, but I doubt that would be an area of concern as it seems to have just 'stopped working'. the following code was working to retrieve the usd price, now for some reason its not <?php require 'Mysql.php'; require 'Util.php'; $file = file_get_contents(" http://blockchain.info/ticker"); $vars = json_decode($file, true); $usd = $vars['USD']['15m']; $net_usd = number_format((($usd) * (100 - Settings::fee)) / 100, 2); echo $net_usd returns zero when should be the price. offering 0.1 btc to someone who can fix. Try changing the url in file_get_contents to be https:// $file = file_get_contents("https://blockchain.info/ticker"); Blockchain.info recently changed some things around, and maybe you're not getting the file through redirect. I was able to use http and it seems that there is no redirects without https. Blockchain is behind cloudflare which could be causing blocking issues (I've had it various times before).
|
BTC Address: 13mUzcjYysbgNWstbasJ3PVkPB2nCUEqFg
|
|
|
dozerz (OP)
Legendary
Offline
Activity: 2215
Merit: 1057
|
|
December 17, 2014, 06:31:05 AM |
|
the following code was working to retrieve the usd price, now for some reason its not <?php require 'Mysql.php'; require 'Util.php'; $file = file_get_contents(" http://blockchain.info/ticker"); $vars = json_decode($file, true); $usd = $vars['USD']['15m']; $net_usd = number_format((($usd) * (100 - Settings::fee)) / 100, 2); echo $net_usd returns zero when should be the price. offering 0.1 btc to someone who can fix. Try changing the url in file_get_contents to be https:// $file = file_get_contents("https://blockchain.info/ticker"); Blockchain.info recently changed some things around, and maybe you're not getting the file through redirect. winner, updating to https worked - strange it doesn't redirect. send me your btc address
|
space for rent, shilling for sats
|
|
|
ebx
Newbie
Offline
Activity: 27
Merit: 0
|
|
December 17, 2014, 06:35:57 AM |
|
the following code was working to retrieve the usd price, now for some reason its not <?php require 'Mysql.php'; require 'Util.php'; $file = file_get_contents(" http://blockchain.info/ticker"); $vars = json_decode($file, true); $usd = $vars['USD']['15m']; $net_usd = number_format((($usd) * (100 - Settings::fee)) / 100, 2); echo $net_usd returns zero when should be the price. offering 0.1 btc to someone who can fix. Try changing the url in file_get_contents to be https:// $file = file_get_contents("https://blockchain.info/ticker"); Blockchain.info recently changed some things around, and maybe you're not getting the file through redirect. winner, updating to https worked - strange it doesn't redirect. send me your btc address 1LyFGwVPJKD1P7fAn686q5Y8yQnHzuF6ZM Thanks!
|
|
|
|
|