Bitcoin Forum
November 06, 2024, 12:04:52 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: « 1 [2] 3 »  All
  Print  
Author Topic: Looking for a PHP /HTML/Xapo-API Person !  (Read 2240 times)
Gifted (OP)
Hero Member
*****
Offline Offline

Activity: 504
Merit: 501



View Profile
July 14, 2016, 03:03:47 PM
 #21

Here is an example of someone else doing it. http://moonbit.co.in

As you can see there is a balance up top in a counter. If your a Xapo client the API knows and leaves at zero but if not the API shows the balance automatic.
Its basically the same  API calls but using the input box for address and the claim button to call the API to check/chnage threshold and post the balance if an Xapo acccount.  Here is the faucet script we are all using. https://github.com/destinybogan/Faucet-Builder
icanscript
Hero Member
*****
Offline Offline

Activity: 686
Merit: 502



View Profile
July 14, 2016, 04:03:49 PM
 #22

Here is an example of someone else doing it. http://moonbit.co.in

As you can see there is a balance up top in a counter. If your a Xapo client the API knows and leaves at zero but if not the API shows the balance automatic.
Its basically the same  API calls but using the input box for address and the claim button to call the API to check/chnage threshold and post the balance if an Xapo acccount.  Here is the faucet script we are all using. https://github.com/destinybogan/Faucet-Builder

Thanks for the tip, Very much appreciated.

I cant see the counter at the top.

So a form. They enter their email or BTC address.

If xapo show balance and set a threshold of 0? if not xapo do nothing?


Gifted (OP)
Hero Member
*****
Offline Offline

Activity: 504
Merit: 501



View Profile
July 14, 2016, 09:55:18 PM
 #23

Here is an example of someone else doing it. http://moonbit.co.in

As you can see there is a balance up top in a counter. If your a Xapo client the API knows and leaves at zero but if not the API shows the balance automatic.
Its basically the same  API calls but using the input box for address and the claim button to call the API to check/chnage threshold and post the balance if an Xapo acccount.  Here is the faucet script we are all using. https://github.com/destinybogan/Faucet-Builder

Thanks for the tip, Very much appreciated.

I cant see the counter at the top.

So a form. They enter their email or BTC address.

If xapo show balance and set a threshold of 0? if not xapo do nothing?



You will have to sign in to see up top... if Xapo no balance or threshold and counter is 0    if non Xapo counter shows balance
5ub_zer0
Full Member
***
Offline Offline

Activity: 238
Merit: 100



View Profile
July 14, 2016, 10:56:37 PM
 #24

OK .. cant sleep .. got an idea and testet it .. it works .. not at the best but a beginning .. ok what have i done ..

i took this part of script
Code:
<?php

require_once("functions.php");

$sToken json_decode(GetAuthToken());

if(isset(
$_POST['addyBalance'])){

$addyBalance $_POST['addyBalance'];

if(empty(
$addyBalance)) {
   echo 
"No Address Entered";
   die();
}

   
$ch curl_init();
   
curl_setopt($chCURLOPT_URL"https://v2.api.xapo.com/addresses/" $addyBalance);
   
curl_setopt($chCURLOPT_RETURNTRANSFERTRUE);
   
curl_setopt($chCURLOPT_HEADERFALSE);
   
curl_setopt($chCURLOPT_HTTPHEADER, array(
     
"Authorization: Bearer " $sToken->access_token
   
));
   
$response curl_exec($ch);

and change the word "addyBalance" into username and "$addyBalance" into $username

this Code i put into the main index.php (not the style one) after the  if($response->success){ line ...

Code:
    if($response->success){
//EDIT
require_once("check/functions.php");

$sToken = json_decode(GetAuthToken());

   $ch = curl_init();
   curl_setopt($ch, CURLOPT_URL, "https://v2.api.xapo.com/addresses/" . $username);
   curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
   curl_setopt($ch, CURLOPT_HEADER, FALSE);
   curl_setopt($ch, CURLOPT_HTTPHEADER, array(
     "Authorization: Bearer " . $sToken->access_token
   ));
   $response = curl_exec($ch);
//EDITEND

Then i open the Style index.php and puted in
Code:
     <div><strong><p class="alert alert-info">
    <?php
      $jsonresponse 
json_decode($response);
      echo 
'Your current balance = ' $jsonresponse->accrued_balance ' Cashout at = ' $jsonresponse->payment_threshold;
     
?>
</div>


OK now when i as non Xapo user Claim with the BTC Address i can see my Balance .. but now come the ugly part .. if i reload the browser its dissapears ... and i have to wait for the next claim .. maybe there is a smarter solution ?  Wink
Gifted (OP)
Hero Member
*****
Offline Offline

Activity: 504
Merit: 501



View Profile
July 15, 2016, 01:16:33 AM
 #25

OK .. cant sleep .. got an idea and testet it .. it works .. not at the best but a beginning .. ok what have i done ..

i took this part of script
Code:
<?php

require_once("functions.php");

$sToken json_decode(GetAuthToken());

if(isset(
$_POST['addyBalance'])){

$addyBalance $_POST['addyBalance'];

if(empty(
$addyBalance)) {
   echo 
"No Address Entered";
   die();
}

   
$ch curl_init();
   
curl_setopt($chCURLOPT_URL"https://v2.api.xapo.com/addresses/" $addyBalance);
   
curl_setopt($chCURLOPT_RETURNTRANSFERTRUE);
   
curl_setopt($chCURLOPT_HEADERFALSE);
   
curl_setopt($chCURLOPT_HTTPHEADER, array(
     
"Authorization: Bearer " $sToken->access_token
   
));
   
$response curl_exec($ch);

and change the word "addyBalance" into username and "$addyBalance" into $username

this Code i put into the main index.php (not the style one) after the  if($response->success){ line ...

Code:
    if($response->success){
//EDIT
require_once("check/functions.php");

$sToken = json_decode(GetAuthToken());

   $ch = curl_init();
   curl_setopt($ch, CURLOPT_URL, "https://v2.api.xapo.com/addresses/" . $username);
   curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
   curl_setopt($ch, CURLOPT_HEADER, FALSE);
   curl_setopt($ch, CURLOPT_HTTPHEADER, array(
     "Authorization: Bearer " . $sToken->access_token
   ));
   $response = curl_exec($ch);
//EDITEND

Then i open the Style index.php and puted in
Code:
     <div><strong><p class="alert alert-info">
    <?php
      $jsonresponse 
json_decode($response);
      echo 
'Your current balance = ' $jsonresponse->accrued_balance ' Cashout at = ' $jsonresponse->payment_threshold;
     
?>
</div>


OK now when i as non Xapo user Claim with the BTC Address i can see my Balance .. but now come the ugly part .. if i reload the browser its dissapears ... and i have to wait for the next claim .. maybe there is a smarter solution ?  Wink
  Im not sure what you did so i will go to your website and check
Gifted (OP)
Hero Member
*****
Offline Offline

Activity: 504
Merit: 501



View Profile
July 15, 2016, 01:20:06 AM
Last edit: July 15, 2016, 02:15:22 AM by Gifted
 #26

ok , i think i know what your trying to do...i will try and complete but im not an expert



ahh what a headache
alfaboy23
Hero Member
*****
Offline Offline

Activity: 546
Merit: 500



View Profile
July 15, 2016, 04:03:54 AM
 #27

Hi, glad to see this thread moving.

@icanscript i would like to send you some BTC even though it was made before you completed here for your time. Also what he is saying is a great idea as far as setting threshold automatic or even to let them change it themselves . What i'm trying to figure out is how to have a balance for non Xapo users on the front page and is automatically checked when claimed instead of what i did here. http://www.bitcoinfaucetexchange.com/Balance.php

Though the page is a better advertising platform....would be more better in the front page.

Do you mean.

A user who uses the faucet who IS NOT a Xapo user also has a balance? so when they reach a certain amount they can then withdraw? and cant withdraw until they reach that amount?

That would work slightly differently, as we would need to store their addresses value, which we could do in a db like mysql, or a flatdb file.

My address is 1Dt5KPqWQ18L4EQ3DWzriHLnKfDg45uTx7 , thanks for any tips.

Regards,

icanscript
No, the account is held by Xapo and will show the balance if API is called but if its a email or a Xapo account BTC address the counter is always zero. subzero is talking about automatic setting threshold for 10,000 but for me it would be cool just to call the API automatic when claimed...so there is also an api call to change the threshold for any non-Xapo address.so no need for SQL table.
 I sent you a tip  https://blockchain.info/address/1Dt5KPqWQ18L4EQ3DWzriHLnKfDg45uTx7   Wink
The concept is the same as getting the own account balance, just like what I did to get my faucet's remaining balance. The difference is after claiming, we have to get the address from the address box then call the API to get the balance of that address, it will show 0 if the address is an e-mail. But it will only show after a successful claim, just like the referral link in Xapo faucets, only showing after a successful claim.
5ub_zer0
Full Member
***
Offline Offline

Activity: 238
Merit: 100



View Profile
July 15, 2016, 04:57:39 AM
 #28

ok , i think i know what your trying to do...i will try and complete but im not an expert



ahh what a headache

Thats how it looks after claim with BTC Address


With Xapo EMail is zero cause we have no threshold and it immidiatly send out - thats correct
icanscript
Hero Member
*****
Offline Offline

Activity: 686
Merit: 502



View Profile
July 15, 2016, 06:18:25 AM
 #29

ok , i think i know what your trying to do...i will try and complete but im not an expert



ahh what a headache

Thats how it looks after claim with BTC Address


With Xapo EMail is zero cause we have no threshold and it immidiatly send out - thats correct

But that would require some form of storing the current account balance for that address if its not xapo. so we know how much the address has before it can be released.
5ub_zer0
Full Member
***
Offline Offline

Activity: 238
Merit: 100



View Profile
July 15, 2016, 07:38:59 AM
 #30

But that would require some form of storing the current account balance for that address if its not xapo. so we know how much the address has before it can be released.

I have no clue .. but an other "idea" .. could we work with a cookie here maybe ?
icanscript
Hero Member
*****
Offline Offline

Activity: 686
Merit: 502



View Profile
July 15, 2016, 07:43:50 AM
 #31

But that would require some form of storing the current account balance for that address if its not xapo. so we know how much the address has before it can be released.

I have no clue .. but an other "idea" .. could we work with a cookie here maybe ?

We could. but if the users uses a diff browser or clears his cookies he has lost his accrued amount. this would have to be stored server side.
alfaboy23
Hero Member
*****
Offline Offline

Activity: 546
Merit: 500



View Profile
July 15, 2016, 11:24:19 AM
 #32

But that would require some form of storing the current account balance for that address if its not xapo. so we know how much the address has before it can be released.

I have no clue .. but an other "idea" .. could we work with a cookie here maybe ?

We could. but if the users uses a diff browser or clears his cookies he has lost his accrued amount. this would have to be stored server side.
How about, we add an additional table in the existing SQL database just for the payout threshold. Then it's like this:
-The user will enter a wallet address,
-Solve the captcha,
-Click Claim,
-The script will enter the address to the payout table and if the address exist,
-The script will proceed to getting the balance of the wallet address from Xapo,
-Then the script will write the value to the table overwriting the previous stored value, if any.

In the SQL table using phpMyAdmin panel, it will look like this:


What do you think?
icanscript
Hero Member
*****
Offline Offline

Activity: 686
Merit: 502



View Profile
July 15, 2016, 11:26:17 AM
 #33

But that would require some form of storing the current account balance for that address if its not xapo. so we know how much the address has before it can be released.

I have no clue .. but an other "idea" .. could we work with a cookie here maybe ?

We could. but if the users uses a diff browser or clears his cookies he has lost his accrued amount. this would have to be stored server side.
How about, we add an additional table in the existing SQL database just for the payout threshold. Then it's like this:
-The user will enter a wallet address,
-Solve the captcha,
-Click Claim,
-The script will enter the address to the payout table and if the address exist,
-The script will proceed to getting the balance of the wallet address from Xapo,
-Then the script will write the value to the table overwriting the previous stored value, if any.

In the SQL table using phpMyAdmin panel, it will look like this:


What do you think?

OP wants no SQL side tables created. I suggested this or a flatfile db further up.
5ub_zer0
Full Member
***
Offline Offline

Activity: 238
Merit: 100



View Profile
July 15, 2016, 12:41:01 PM
 #34

I am interesstet in the SQL solution  Tongue
Gifted (OP)
Hero Member
*****
Offline Offline

Activity: 504
Merit: 501



View Profile
July 16, 2016, 02:06:41 AM
 #35

I think what ever works its ok  but since Xapo hold the balance  i dont see the reason to have a table other then maybe easier for some one to code.  how does the balance change when xapo pays it because they pay it not the faucet
alfaboy23
Hero Member
*****
Offline Offline

Activity: 546
Merit: 500



View Profile
July 16, 2016, 04:04:18 AM
 #36

I think what ever works its ok  but since Xapo hold the balance  i dont see the reason to have a table other then maybe easier for some one to code.  how does the balance change when xapo pays it because they pay it not the faucet
Yeah you're right, Xapo hold the balances and Xapo pays directly to the wallet address once the threshold meets, any custom database tables are not needed, we just have to get/query the balance from the Xapo account using just the API, just like what 5ub_zero did.
icanscript
Hero Member
*****
Offline Offline

Activity: 686
Merit: 502



View Profile
July 16, 2016, 09:32:26 AM
 #37

I think what ever works its ok  but since Xapo hold the balance  i dont see the reason to have a table other then maybe easier for some one to code.  how does the balance change when xapo pays it because they pay it not the faucet

I was meaning other people who are NOT xapo though, What happens to them? if you want them to accrue a balance without being paid directly their balance will need to be stored somewhere.
Gifted (OP)
Hero Member
*****
Offline Offline

Activity: 504
Merit: 501



View Profile
July 16, 2016, 11:15:08 AM
 #38

I think what ever works its ok  but since Xapo hold the balance  i dont see the reason to have a table other then maybe easier for some one to code.  how does the balance change when xapo pays it because they pay it not the faucet

I was meaning other people who are NOT xapo though, What happens to them? if you want them to accrue a balance without being paid directly their balance will need to be stored somewhere.
Thats who we are talking about non Xapo acccounts
5ub_zer0
Full Member
***
Offline Offline

Activity: 238
Merit: 100



View Profile
July 16, 2016, 05:35:22 PM
Last edit: July 16, 2016, 05:55:52 PM by 5ub_zer0
 #39

maybe we misunderstand us a bit  Roll Eyes ..

For Xapo users the Balance is not needed (show 0 or nothing) .. because they will get the payout immediately (no threshold - [some other xapo faucet's have] - i am not).

For NON Xapo users the idea:

user claim -> Script get the balance from Xapo via API and is showing on the Faucet Site (this is working! - this is the point we are at the moment - https://bitcointalk.org/index.php?topic=1508823.msg15587870#msg15587870)

but if the user left the page and come back or do a browser refresh .. the balance disapear! .. the balance will only show again when he can claim again (after countdown).


Now what would really cool:
User left page and come back or do a brwoser refresh the Balance is still showing.

So maybe this only works with a login impementation via database (like moonbitcoin) or cookie-based .. i know cookie based is not server-side but if i use multi device i deal with it to see the balance after enter the BTC Address

 
icanscript
Hero Member
*****
Offline Offline

Activity: 686
Merit: 502



View Profile
July 16, 2016, 05:50:51 PM
 #40

maybe we misunderstand us a bit  Roll Eyes ..

For Xapo users the Balance is not needed (show 0 or nothing) .. because they will get the payout immediately (no threshold - [some other xapo faucet's have] - i am not).

For NON Xapo users the idea:

user claim -> Script get the balance from Xapo via API (this is working! - this is the point we are at the moment)

but if the user left the page and come back or do a browser refresh .. the balance disapear! .. the balance will only show again when he can claim again (after countdown).


Now what would really cool:
User left page and come back or do a brwoser refresh the Balance is still showing.

So maybe this only works with a login impementation via database (like moonbitcoin) or cookie-based .. i know cookie based is not server-side but if i use multi device i deal with it to see the balance after enter the BTC Address

 

Okay okay, I understand now.

best way to deal with this is mysql. just holding a balance for an address (no login). if user comes along with same address and his accrued balance reaches threshold, he gets paid (then his accrued balance goes to 0) and we start over with that user. or that address.

only question is, do you have anything in place to stop users using different addresses from the same IP/user agent so quickly. he could user about 30 different addresses and get paid all at same time.
Pages: « 1 [2] 3 »  All
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!