Jump to content
DJNeo

Perl API - Noob

Recommended Posts

Posted
      my $mech = WWW::Mechanize->new();
      $mech->get("https://blockchain.info/q/getreceivedbyaddress/".$btcaddress);   # Check transactions on bitcoin address
      my $getreceived = $mech->content;

      $mech->get("https://blockchain.info/q/addressbalance/".$btcaddress);   # Check balance on bitcoin address
      my $addressbalance = $mech->content;

Exemplu rezultat: https://blockchain.info/q/getreceivedbyaddress/1GbVUSW5WJmRCpaCJ4hanUny77oDaWW4to => 900403294973

                          https://blockchain.info/q/addressbalance/1GbVUSW5WJmRCpaCJ4hanUny77oDaWW4to => 51689529709

Daca folosesc blockexplorer.com https://blockexplorer.com/api/addr/1GbVUSW5WJmRCpaCJ4hanUny77oDaWW4t ,rezultatul este...hacea-parcea.
Ca sa am acelasi rezultat ca pe blockchain,trebuie sa pun /balance dupa link,respectiv /totalReceived

https://blockexplorer.com/api/addr/1GbVUSW5WJmRCpaCJ4hanUny77oDaWW4to/balance

https://blockexplorer.com/api/addr/1GbVUSW5WJmRCpaCJ4hanUny77oDaWW4to/totalReceived

 

Acum...cum pun in cod..."/balance" si "/totalReceived" !?

 

Am incercat gen:
      $mech->get("https://blockexplorer.com/api/addr/".$btcaddress/balance);   # Check transactions on bitcoin address

      $mech->get("https://blockexplorer.com/api/addr/".$btcaddress./balance);   # Check transactions on bitcoin address

      $mech->get("https://blockexplorer.com/api/addr/".$btcaddress "/balance");   # Check transactions on bitcoin address

      $mech->get("https://blockexplorer.com/api/addr/.$btcaddress/balance");   # Check transactions on bitcoin address

insa...nici-o versiune nu functioneaza...

Astept un mic ajutor de la cunoscatori :P

 


 

 

 
Posted

Hint, ce vrei tu sa faci se numeste concatenare.

 

Tu faci deja asta: 

"https://blockchain.info/q/getreceivedbyaddress/".$btcaddress

Adica:

"text" . $variabila

Iar tu ai nevoie de:

"text" . $variabila . "text in continuare"

Respectiv, 

$mech->get("https://blockexplorer.com/api/addr/".$btcaddress . "/balance");

 

  • Upvote 1
Posted (edited)
22 minutes ago, DJNeo said:

Apreciez insa...am incercat deja asa...dupa cum am si specificat incercarile esuate...

 

In lista cu incercari esuate nu ai inclus ce ti-a propus @pr00f

 

Tu ai incercat:     $mech->get("https://blockexplorer.com/api/addr/".$btcaddress "/balance");

Iar el ti-a propus: $mech->get("https://blockexplorer.com/api/addr/".$btcaddress . "/balance");

 

Punctul ala ce-l ai si inainte de variabila "$btcaddress" este operatorul de concaternare in Perl.

 

Edited by BogdanNBV

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...