Guest User

Untitled

a guest
Oct 4th, 2016
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. <?php
  2.  
  3. function bitmarket_api($method, $params = array())
  4. {
  5. $key = "klucz_jawny";
  6. $secret = "klucz_tajny";
  7.  
  8. $params["method"] = $method;
  9. $params["tonce"] = time();
  10.  
  11. $post = http_build_query($params, "", "&");
  12. $sign = hash_hmac("sha512", $post, $secret);
  13. $headers = array(
  14. "API-Key: " . $key,
  15. "API-Hash: " . $sign,
  16. );
  17.  
  18. $curl = curl_init();
  19. curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  20. curl_setopt($curl, CURLOPT_URL, "https://www.bitmarket.pl/api2/");
  21. curl_setopt($curl, CURLOPT_POST, true);
  22. curl_setopt($curl, CURLOPT_POSTFIELDS, $post);
  23. curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
  24. $ret = curl_exec($curl);
  25.  
  26. return json_decode($ret);
  27. }
  28.  
  29. bitmarket_api("info");
  30.  
  31. ?>
Advertisement
Add Comment
Please, Sign In to add comment