Author

Topic: Faucetbox Balance (Read 351 times)

full member
Activity: 238
Merit: 100
November 04, 2016, 12:38:10 PM
#7
Thanks !!!!!

i have founded with json

very very thank you !!!!!!!!!  Shocked Grin

Could you tell us how you did it ?

EDIT
OK have found a way to do it too  Cheesy

Code:
// Get cURL resource
$curl curl_init();
// Set some options
curl_setopt_array($curl, array(
    
CURLOPT_RETURNTRANSFER => 1,
    
CURLOPT_URL => 'https://faucetbox.com/api/v1/balance',
    
CURLOPT_HTTPHEADER, array('Content-Type: application/json'),
    
CURLOPT_POST => 1,
    
CURLOPT_POSTFIELDS => array(
        
api_key => '123456789',
currency => 'BTC'
    
)
));
// Send the request & save response to $resp
$resp curl_exec($curl);
// Close request to clear up some resources
curl_close($curl);

$json json_decode($resptrue);

// print_r($json);
?>


Bitcoin Balance


echo $json['balance_bitcoin'];?>
member
Activity: 83
Merit: 10
November 04, 2016, 10:56:11 AM
#6
Thanks !!!!!

i have founded with json

very very thank you !!!!!!!!!  Shocked Grin
member
Activity: 83
Merit: 10
November 04, 2016, 08:33:22 AM
#5
yeah it's work  Grin

response --> {"status":200,"balance":54511983,"balance_bitcoin":"0.54511983"}

is there still a possibility to output only the value of balance ...

example: --> 54511983 Satoshi
example: -->

or similar
full member
Activity: 238
Merit: 100
November 04, 2016, 08:08:50 AM
#4
i have not original faucetinabox script.

ok sorry, than my suggestion doesnt work :-)

try this:

Code:
// Get cURL resource
$curl curl_init();
// Set some options - we are passing in a useragent too here
curl_setopt_array($curl, array(
    
CURLOPT_RETURNTRANSFER => 1,
    
CURLOPT_URL => 'https://faucetbox.com/api/v1/balance',
    
CURLOPT_USERAGENT => ' balance api test',
    
CURLOPT_POST => 1,
    
CURLOPT_POSTFIELDS => array(
        
api_key => '123456789',
currency => 'BTC'
    
)
));
// Send the request & save response to $resp
$resp curl_exec($curl);
// Close request to clear up some resources
curl_close($curl);
?>


echo ($resp);?>
member
Activity: 83
Merit: 10
November 04, 2016, 07:51:57 AM
#3
sry it not works.....i have not original faucetinabox script....i have also not faucetinabox mysql

i want a simple displaying

the balance: 55252525 Satoshi....that's all
i want a simple request from Faucetbox Api

i have tested with

$urlbase = "https://faucetbox.com/api/v1/balance";
$api_key ='--------your Site-Key---------';
$currency ='xpm';
$balance = file_get_contents_curl($urlbase.'/api_key='.$api_key.'¤cy='.$currency);

echo $balance;

the get methods not working and from the post method i have no plans :-)
Curl is available

regards


full member
Activity: 238
Merit: 100
November 04, 2016, 07:22:35 AM
#2
If you have the credentials to the database you can try to create a file named i.ex balance.php and put the following in:


Code:
define 'MYSQL_HOST',      'localhost' );
define 'MYSQL_USER',  'your-database-user' );
define 'MYSQL_PASSWORD',  'database-user-password' );
define 'MYSQL_DATABASE''faucetdatabasename' );

$db_link mysqli_connect (
                     
MYSQL_HOST
                     
MYSQL_USER
                     
MYSQL_PASSWORD
                     
MYSQL_DATABASE
                    
);
$sql "SELECT * FROM Faucetinabox_Settings LIMIT 3, 1";
 
$db_erg mysqli_query$db_link$sql );
if ( ! 
$db_erg )
{
  die(
'fail request: ' mysqli_error());
}
 
echo 
'';
while (
$zeile mysqli_fetch_array$db_ergMYSQL_ASSOC))
{
  echo 
"";
  echo 
""Bitcoin .   "";
  echo 
""$zeile['name'] . "";
  echo 
""$zeile['value'] . "";
  echo 
"";
}
echo 
"";
 
mysqli_free_result$db_erg );

?>


in the first 4 rows (define) put in your data
member
Activity: 83
Merit: 10
November 04, 2016, 05:47:33 AM
#1
Hello I wanted to ask if anyone can help me, please.

I would like to show the balance of my XPM and BTC Faucet on another side - the variables are not so available.

my php is not good - please help!

sry my english is bad :-)

Curl is available
Jump to: