Hi Bitcoin fans
I am currently building a website with PHP/SQL to sell products in Bitcoins (Nice Swiss stuff...watch out!) and am willing to verify if an amount has been sent to a bitcoin adress I provide when submitting a form.
I have to list the adresses which contains Bitcoins along with their payement status(show amount if verified), so I am looking for the simplest way of doing this.
I found out this piece of code, regarding blockexplorer:
$Awallets = $row['wallet'];
$Live_Address_Scan = "
http://blockexplorer.com/q/getreceivedbyaddress/$Awallets";
$ch = curl_init($Live_Address_Scan);
curl_setopt($ch, CURLOPT_REFERER, 'Mozilla/5.0 (compatible; GetReceivedBy; '.php_uname('s').'; PHP/'.phpversion().')');
curl_setopt($ch, CURLOPT_USERAGENT, "CakeScript/0.1");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$Donated_Bitcoins = curl_exec($ch);
curl_close($ch);
But eventually there are some 'moments' where blockexplorer cannot be sollicited so an error message shows up in the field where the amount should appear
'Database overload...'
I then came up about blockchain and I have to use this specific code:
HTTP Post
A HTTP POST request will be made on payment sent or received to URL provided on your My Account page. The POST body will contain one "payload" variable which contains JSON data about the transaction. Any effect on your wallet will need to be calculated by your server.
e.g. Access JSON using php
$_POST['payload']
{
"hash": "bf8648b06160ded3274d6054cfeadd95f762271170070429ef40d62ac5452c4b",
"ver": 1,
"vin_sz": 1,
"vout_sz": 2,
"lock_time": "Unavailable",
"size": 258,
"relayed_by": "71.238.174.98",
"tx_index": 13903761,
"time": 1325700693,
"inputs": [
{
"prev_out": {
"hash": "e417eb0889a1870e6b500ad8769cb7110739749e",
"addr": "1Mo3ibZuqZpsBGimyfmUnYDiZoU44VbAJV",
"value": 438000000,
"tx_index": 13902462,
"n": 1
}
}
],
"out": [
{
"value": 215000000,
"hash": "6c835372a306b2e253f896801cb0b5703d60114c",
"addr": "1AtmJQYUCVZSwoLkQvEvFhtoRfwn4Eumuu"
},
{
"value": 222000000,
"hash": "60ce49cd97aa152e1db8a76c1b62c55ae3b059d3",
"addr": "19przaW7NeE96SEVtKGWdGM3CuKVaSYhrS"
}
]
}
As a rudimentary form of verification the HTTP server should respond by printing the user's wallet identifier.
echo '0aef6e46-2422-6d4c-772c-bacccf378b6b';
I managed to have a recognized listener adress along with the echo 'wallet', but then, how do I parse this JSON string? May I ask if someone could point me to the right direction or even show me some code? I do not know how to 'begin', like is it in a
A thousands thanks in advance,