michaeladair (OP)
Sr. Member
![*](https://bitcointalk.org/Themes/custom1/images/star.gif) ![*](https://bitcointalk.org/Themes/custom1/images/star.gif) ![*](https://bitcointalk.org/Themes/custom1/images/star.gif)
Offline
Activity: 448
Merit: 250
I'm a Web Developer: HTML, CSS, PHP, JS.
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
December 16, 2014, 11:01:39 PM |
|
Being newish to PHP, I have no clue how to do curls... If anyone can tell me why this is not showing anything, that'd be great. <?php $ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://blockchain.info/address/1CYjYBLn5gaGV5psfSG5e9m1BFDo9M4Gr5");
$output = curl_exec($ch);
curl_close($ch);
echo $output;
|
|
|
|
|
michaeladair (OP)
Sr. Member
![*](https://bitcointalk.org/Themes/custom1/images/star.gif) ![*](https://bitcointalk.org/Themes/custom1/images/star.gif) ![*](https://bitcointalk.org/Themes/custom1/images/star.gif)
Offline
Activity: 448
Merit: 250
I'm a Web Developer: HTML, CSS, PHP, JS.
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
December 16, 2014, 11:06:07 PM |
|
My friend said you don't always have to end your code in php or you may get an error or something... and I just want it to give me a json of each incoming transaction, along with amounts and date... I have no clue how to pick and choose what it gives me.
|
|
|
|
|
williamj2543
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
December 16, 2014, 11:12:45 PM |
|
If you want to parse the address data do this Its not curl, but still works and with less lines of code $data = json_decode(file_get_contents(" https://blockchain.info/address/1CYjYBLn5gaGV5psfSG5e9m1BFDo9M4Gr5?format=json") , true); $address = $data['address']; Learn how to parse json, but this is how you get a data which isn't under any sub array, this will return the address back to you in the variable $address
|
██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████
|
|
|
michaeladair (OP)
Sr. Member
![*](https://bitcointalk.org/Themes/custom1/images/star.gif) ![*](https://bitcointalk.org/Themes/custom1/images/star.gif) ![*](https://bitcointalk.org/Themes/custom1/images/star.gif)
Offline
Activity: 448
Merit: 250
I'm a Web Developer: HTML, CSS, PHP, JS.
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
December 16, 2014, 11:13:26 PM |
|
Well I can do this To get like the hash of the first transaction, but I do not know how to display the code or even where to put it in my code above... ^^^ Plus, I also want to fish out more information other than just the hash...
|
|
|
|
Parazyd
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
December 16, 2014, 11:14:43 PM |
|
|
|
|
|
michaeladair (OP)
Sr. Member
![*](https://bitcointalk.org/Themes/custom1/images/star.gif) ![*](https://bitcointalk.org/Themes/custom1/images/star.gif) ![*](https://bitcointalk.org/Themes/custom1/images/star.gif)
Offline
Activity: 448
Merit: 250
I'm a Web Developer: HTML, CSS, PHP, JS.
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
December 16, 2014, 11:16:59 PM |
|
Does set the variable $a as the hash of the first transaction? If so, how do I get it so that I can end up doing foreach in my php to make a table that displays the information for each transaction?
|
|
|
|
|
michaeladair (OP)
Sr. Member
![*](https://bitcointalk.org/Themes/custom1/images/star.gif) ![*](https://bitcointalk.org/Themes/custom1/images/star.gif) ![*](https://bitcointalk.org/Themes/custom1/images/star.gif)
Offline
Activity: 448
Merit: 250
I'm a Web Developer: HTML, CSS, PHP, JS.
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
December 16, 2014, 11:24:29 PM |
|
Okay, well just tell me this last thing.... Where do I put my parse into my code?
|
|
|
|
Parazyd
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
December 16, 2014, 11:26:52 PM |
|
After you grab the JSON data, logically.
|
|
|
|
michaeladair (OP)
Sr. Member
![*](https://bitcointalk.org/Themes/custom1/images/star.gif) ![*](https://bitcointalk.org/Themes/custom1/images/star.gif) ![*](https://bitcointalk.org/Themes/custom1/images/star.gif)
Offline
Activity: 448
Merit: 250
I'm a Web Developer: HTML, CSS, PHP, JS.
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
December 16, 2014, 11:29:07 PM |
|
After you grab the JSON data, logically.
So you're telling me that I just do it like this? <?php $ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://blockchain.info/address/1CYjYBLn5gaGV5psfSG5e9m1BFDo9M4Gr5");
$output = curl_exec($ch);
curl_close($ch);
echo $output;
$a["txs"][0]["hash"] ?>
|
|
|
|
Parazyd
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
December 16, 2014, 11:32:22 PM |
|
Just start learning PHP, okay? This is basic stuff. I ain't helping you, and I suggest others to stay away too. This isn't leading you anywhere.
|
|
|
|
michaeladair (OP)
Sr. Member
![*](https://bitcointalk.org/Themes/custom1/images/star.gif) ![*](https://bitcointalk.org/Themes/custom1/images/star.gif) ![*](https://bitcointalk.org/Themes/custom1/images/star.gif)
Offline
Activity: 448
Merit: 250
I'm a Web Developer: HTML, CSS, PHP, JS.
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
December 17, 2014, 12:01:30 PM Last edit: December 17, 2014, 12:12:13 PM by michaeladair |
|
I got this far, but it still won't display anything at all... Anyone wanna just tell me how I can get it to display something? <html> <title>Michael</title> <body> <?php $ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://blockchain.info/address/1CYjYBLn5gaGV5psfSG5e9m1BFDo9M4Gr5");
$output = curl_exec($ch);
curl_close($ch);
echo $output;
$a=json_decode($output,TRUE);
$a["txs"] ?> <table> <tr> <td> <?php print_r($a["txs"]); ?> </td> </tr> </table> </body> </html> Why can't I parse nice things?!
|
|
|
|
williamj2543
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
December 17, 2014, 12:35:12 PM |
|
You forgot a semicolon.
|
██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████
|
|
|
michaeladair (OP)
Sr. Member
![*](https://bitcointalk.org/Themes/custom1/images/star.gif) ![*](https://bitcointalk.org/Themes/custom1/images/star.gif) ![*](https://bitcointalk.org/Themes/custom1/images/star.gif)
Offline
Activity: 448
Merit: 250
I'm a Web Developer: HTML, CSS, PHP, JS.
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
December 17, 2014, 12:44:08 PM |
|
You forgot a semicolon.
Oh lol, thanks.
|
|
|
|
|