blijkbaar moet ik vps hebben om het te laten werken.
Is de VPS van versio aan te raden en hoe koppel ik die domeinnamen?
blijkbaar moet ik vps hebben om het te laten werken.
Is de VPS van versio aan te raden en hoe koppel ik die domeinnamen?
ah, ik zal eens kijken. had de link over hoofd gezien.
https en zonders s geprobeerd NULL krijg ik altijd maar weet niet wat ik verkeerd doe.
maar als ik het adres verander naar een juist adres krijg ik true, maar ook met een error.
ik gebruik nu een andere api, deze werkt beter, nu kan ik zien of het adres bestaat of niet. Alleen als het niet bestaat krijg ik deze error: E_WARNING Error in file �faucetbox.php� at line 14: file_get_contents(https://blockchain.info/address/lol?format=json): failed to open stream: HTTP request failed! HTTP/1.1 500 Internal Server Error
code:
maar bij een juist adres werkt het dan wel?
Nu heb ik "not found"
E_WARNING Error in file �faucetbox.php� at line 14: file_get_contents(https://bitcoin.toshi.io/api/v0/addresses/lol): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found NULL valid
var dump is NULL
Dat geeft gewoon "not found" inien foutief adres.
snap ook niet van waar de error komt
foutieve json: https://bitcoin.toshi.io/api/v0/addresses/tralalala
wanneer adres bestaat: https://bitcoin.toshi.io/api/v…8DXnwpjmoU8g9HJLaVSPFjx33
Ik heb hier een probleempje met dit scriptje:
function check_adress($adress){
$url = "https://bitcoin.toshi.io/api/v0/addresses/".$adress."";
if(@file_get_contents($url)){
$result = file_get_contents($url);
$obj = json_decode($result, true);
if(!isset($obj['error'])){
return true;
}
else{
return false;
}
}
else {
return false;
}
}
Toon Meer
en ik krijg deze error: E_WARNING Error in file �faucetbox.php� at line 14: file_get_contents(https://bitcoin.toshi.io/api/v…es/jggjhgvjhfkhfthfkftj): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
ik zou eigenlijk gewoon willen als deze error er is dat hij gewoon false terugstuurt maar ik heb geen flauw idee hoe dit moet.
Ik vind mijn code prettiger om te lezen
Volgens mij is er een probleempje bij versio want ik krijg geen gegevens meer uit de database zonder dat ik iets aangepast heb.
En ik gebruik geen enkele cdn momenteel.
bootswatch + google + site bootstrap zelf
$sorton = "average_reward";
$order = "DESC";
if(isset($_GET['sorton'])){
$sorton = $_GET['sorton'];
$order = $_GET['order'];
}
$order_allow = [
"1" => "ASC",
"2" => "DESC",
];
$sorton_allow = [
"1" => "faucet_name",
"2" => "average_reward",
"3" => "reward_hour",
"4" => "time",
"5" => "payement",
];
if (!in_array($sorton, $sorton_allow)) {
unset($sorton);
$sorton = "average_reward";
}
if (!in_array($order, $order_allow)) {
unset($order);
$order = "DESC";
}
Toon Meer
Is dit dan goed?
Alleen is mijn site supertraag geworden.
edit: site is traag omdat ik externe locatie gebruik voor bootstrap
Ik heb het gefixt, ik hzb gebruik gemaakt van whitelists en deze code:
<?php
$result = $db->prepare("SELECT * FROM faucets ORDER BY ".$sorton." ".$order."");
$result->execute();
$nr=0;
while ($row = $result->fetch(PDO::FETCH_ASSOC))
{
$nr = $nr + 1;
echo "<tr>
<td>".$nr."</td>
<td><a href='".$row['faucet_url']."'>".$row['faucet_name']."</a></td>
<td>".$row['average_reward']."</td>
<td>".$row['reward_hour']."</td>
<td>".$row['wait_time']."</td>
<td>".$row['payement']."</td>
</tr>";
}
?>
Toon Meer
Ik denk dat ik de code maar is opnieuw ga schrijven.
pff. ik heb er echt een zootje van gemaakt geen enkel van bovenstaande werkt.
de volledige pagina:
<?php
include "config.php";
$sorton = "average_reward";
$order = "DESC";
if(isset($_GET['sorton'])){
$sorton = $_GET['sorton'];
$order = $_GET['order'];
}
?>
<html>
<head>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://bootswatch.com/darkly/bootstrap.min.css">
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<!-- Latest compiled JavaScript -->
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<title>Bitylist</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<div class="container">
<div class="jumbotron">
<h1><img src="http://bitcoin.i-rme.es/img/Bitcoin%20Logo%204096%20PNG%20Forocoches%20(RME).png" height="100px">Bitylist</h1>
<p>Welcome to Bitylist! Bitylist is a smart faucetlist where you can open multiple faucets simultaneously instead of clicking them case-by-case. You have also the possibility of sorting them.</p>
<p>Faucet balance: <?php echo get_balance($key); ?> satoshi</p>
<div class="form-group">
<label class="control-label">Claim reward:</label>
<div class="input-group">
<span class="input-group-addon">Bitcoin adress</span>
<input type="text" class="form-control" placeholder="Enter your bitcoin adress here like '1CvBm4AoS7TVVVv5XC1wPiyMrpk4n8rzNC'.">
<span class="input-group-btn">
<button class="btn btn-default" type="button">Claim!</button>
</span>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Faucet list</h3>
</div>
<div class="panel-body">
<div class="form-group">
<form method="post">
<label class="control-label">Open faucets in new window:</label>
<div class="input-group">
<span class="input-group-addon">Till which number?</span>
<input type="text" class="form-control" name="num">
<span class="input-group-btn">
<button class="btn btn-default" type="submit" name="submit">Open!</button>
</span>
</div>
</form>
</div>
<table class="table table-striped table-hover">
<thead>
<tr>
<th>nr.</th>
<th><a href="index.php?sorton=faucet_name&order=ASC">Faucet</a></th>
<th><a href="index.php?sorton=average_reward&order=DESC">average reward</a></th>
<th><a href="index.php?sorton=reward_hour&order=DESC">average reward/hour</a></th>
<th><a href="index.php?sorton=time&order=ASC">interval (min.)</a></th>
<th><a href="index.php?sorton=payement&order=ASC">payement</a></th>
</tr>
</thead>
<tbody>
<?php
$result = $db->prepare("SELECT * FROM faucets ORDER BY ".$sorton." ".$order."");
$result->execute();
//$row = $result->fetchAll(PDO::FETCH_ASSOC);
//print_r($row);
$nr = 0;
while($value = $result->fetch(PDO::FETCH_ASSOC)) {
echo "<tr>";
foreach($value as $row) {
$nr = $nr + 1;
echo "<td>".$nr."</td>
<td><a href='".$row['faucet_url']."'>".$row['faucet_name']."</a></td>
<td>".$row['average_reward']."</td>
<td>".$row['reward_hour']."</td>
<td>".$row['wait_time']."</td>
<td>".$row['payement']."</td>";
}
echo "</tr>";
}
/*$sql = "SELECT * FROM faucets ORDER BY ".$sorton." ".$order."";
$result = $con->query($sql);
if ($result->num_rows > 0) {
// output data of each row
$nr = 0;
while($row = $result->fetch_assoc()) {
$nr = $nr + 1;
echo "
<tr>
<td>".$nr."</td>
<td><a href='".$row['faucet_url']."'>".$row['faucet_name']."</a></td>
<td>".$row['average_reward']."</td>
<td>".$row['reward_hour']."</td>
<td>".$row['wait_time']."</td>
<td>".$row['payement']."</td>
</tr>";
}
}
else {
echo "0 results";
}
*/
?>
</tbody>
</table>
</div>
<div class="panel-footer"><center>© bitypalace.eu | | <a href="mailto:[email protected]?SUBJECT=Bitypalace contact">Contact</a><center></div>
</div>
</div>
<script>
<?php
/*
if (isset($_POST['submit'])){
$result = $db->prepare("SELECT * FROM faucets ORDER BY :sorton :order");
$stmt->bindValue(':sorton', $sorton, PDO::PARAM_STR);
$stmt->bindValue(':order', $order, PDO::PARAM_STR);
$result->execute();
$maxnumber = $_POST['num'];
$number = 0;
while ($row = $db->fetchAll(PDO::FETCH_ASSOC))
{
?>
//add this line for each website you want to open
window.open("<?php echo $row['faucet_url']; ?>",'');
<?php
$number = $number + 1;
if($number == $maxnumber){
break;
}
}*/
/*$sql = "SELECT * FROM faucets ORDER BY ".$sorton." ".$order."";
$result = $con->query($sql);
$maxnumber = $_POST['num'];
$number = 0;
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
?>
//add this line for each website you want to open
window.open("<?php echo $row['faucet_url']; ?>",'');
<?php
$number = $number + 1;
if($number == $maxnumber){
break;
}
}
}
}*/
?>
</script>
</body>
</html>
Toon Meer
10 Of 12 geeft de error, waarom zou de html eruit moeten?
weer iets waarover ik mijn hersenen ben aan het breken:
<?php
$result = $db->prepare("SELECT * FROM faucets ORDER BY :sorton :order");
$result->bindValue(':sorton', $sorton, PDO::PARAM_STR);
$result->bindValue(':order', $order, PDO::PARAM_STR);
$result->execute();
//$row = $result->fetchAll(PDO::FETCH_ASSOC);
//print_r($row);
$nr = 0;
while($value = $result->fetch(PDO::FETCH_ASSOC)) {
echo "<tr>";
foreach($value as $row) {
$nr = $nr + 1;
echo "<td>".$nr."</td>
<td><a href='".$row['faucet_url']."'>".$row['faucet_name']."</a></td>
<td>".$row['average_reward']."</td>
<td>".$row['reward_hour']."</td>
<td>".$row['wait_time']."</td>
<td>".$row['payement']."</td>";
}
echo "</tr>";
}
?>
Toon Meer
de error is hier te bezichten.
Hopelijk kan iemand mij helpen want ik zou niet weten wat ik fout gedaan heb.
hebbes!
Ik moet curl gebruiken i.p.v json decode tenzij ik de ini kan aanpassen. weet iemand of dit kan bij versio?
Volgens de site van de api heeft het gewerkt en heeft hij het getal 200 teruggestuurd.
de api:
<?php
class FaucetBOX
{
protected $api_key;
protected $currency;
public $last_status = null;
protected $api_base = "https://faucetbox.com/api/v1/";
public function __construct($api_key, $currency = "BTC", $disable_curl = false, $verify_peer = true) {
$this->api_key = $api_key;
$this->currency = $currency;
$this->disable_curl = $disable_curl;
$this->verify_peer = $verify_peer;
$this->curl_warning = false;
}
public function __execPHP($method, $params = array()) {
$params = array_merge($params, array("api_key" => $this->api_key, "currency" => $this->currency));
$opts = array(
"http" => array(
"method" => "POST",
"header" => "Content-type: application/x-www-form-urlencoded\r\n",
"content" => http_build_query($params)
),
"ssl" => array(
"verify_peer" => $this->verify_peer
)
);
$ctx = stream_context_create($opts);
$fp = fopen($this->api_base . $method, 'rb', null, $ctx);
$response = stream_get_contents($fp);
if($response && !$this->disable_curl) {
$this->curl_warning = true;
}
fclose($fp);
return $response;
}
public function __exec($method, $params = array()) {
$this->last_status = null;
if($this->disable_curl) {
$response = $this->__execPHP($method, $params);
} else {
$response = $this->__execCURL($method, $params);
}
$response = json_decode($response, true);
if($response) {
$this->last_status = $response['status'];
} else {
$this->last_status = null;
}
return $response;
}
public function __execCURL($method, $params = array()) {
$params = array_merge($params, array("api_key" => $this->api_key, "currency" => $this->currency));
$ch = curl_init($this->api_base . $method);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, $this->verify_peer);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
if(!$response) {
$response = $this->__execPHP($method, $params);
}
curl_close($ch);
return $response;
}
public function send($to, $amount, $referral = "false") {
$r = $this->__exec("send", array("to" => $to, "amount" => $amount, "referral" => $referral));
if (array_key_exists("status", $r) && $r["status"] == 200) {
return array(
'success' => true,
'message' => 'Payment sent to your address using FaucetBOX.com',
'html' => '<div class="alert alert-success">' . htmlspecialchars($amount) . ' satoshi was sent to <a target="_blank" href="https://faucetbox.com/check/' . rawurlencode($to) . '">your FaucetBOX.com address</a>.</div>',
'html_coin' => '<div class="alert alert-success">' . htmlspecialchars(rtrim(rtrim(sprintf("%.8f", $amount/100000000), '0'), '.')) . ' '.$this->currency.' was sent to <a target="_blank" href="https://faucetbox.com/check/' . rawurlencode($to) . '">your FaucetBOX.com address</a>.</div>',
'balance' => $r["balance"],
'balance_bitcoin' => $r["balance_bitcoin"],
'response' => json_encode($r)
);
}
if (array_key_exists("message", $r)) {
return array(
'success' => false,
'message' => $r["message"],
'html' => '<div class="alert alert-danger">' . htmlspecialchars($r["message"]) . '</div>',
'response' => json_encode($r)
);
}
return array(
'success' => false,
'message' => 'Unknown error.',
'html' => '<div class="alert alert-danger">Unknown error.</div>',
'response' => json_encode($r)
);
}
public function sendReferralEarnings($to, $amount) {
return $this->send($to, $amount, "true");
}
public function getPayouts($count) {
$r = $this->__exec("payouts", array("count" => $count) );
return $r;
}
public function getCurrencies() {
$r = $this->__exec("currencies");
return $r['currencies'];
}
public function getBalance() {
$r = $this->__exec("balance");
return $r;
}
}
?>
Toon Meer