read


SUBMITTED BY: Guest

DATE: Dec. 18, 2013, 7:13 a.m.

FORMAT: Text only

SIZE: 1.7 kB

HITS: 822

  1. /Request example
  2. {
  3. "addresses":
  4. [
  5. "1135cJtSMMuascWt4hRiYNjTXcq5JTjEA5",
  6. "112fxrGV41UDCUFFmfzntyd9B8sE96mB3M"
  7. ],
  8. "action": "getBalance"
  9. }
  10. //Response example
  11. {
  12. "1135cJtSMMuascWt4hRiYNjTXcq5JTjEA5":
  13. {
  14. "clicks": "2",
  15. "earnings": "0.000130000000"
  16. },
  17. "112fxrGV41UDCUFFmfzntyd9B8sE96mB3M":
  18. {
  19. "clicks": "1",
  20. "earnings": "0.000625000000"
  21. }
  22. }
  23. PHP example:
  24. $query = array();
  25. $query['addresses'] = array();
  26. $query['action'] = 'getBalance';
  27. $query['addresses'][] = "1135cJtSMMuascWt4hRiYNjTXcq5JTjEA5";
  28. $query['addresses'][] = "112fxrGV41UDCUFFmfzntyd9B8sE96mB3M";
  29. $url = 'http://coinurl.com/revenue-sharing.php';
  30. $content = json_encode($query);
  31. $curl = curl_init($url);
  32. //Enable if you have problems using HTTPS
  33. //curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
  34. //curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
  35. curl_setopt($curl, CURLOPT_HEADER, false);
  36. curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  37. curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-type: application/json"));
  38. curl_setopt($curl, CURLOPT_POST, true);
  39. curl_setopt($curl, CURLOPT_POSTFIELDS, $content);
  40. $result = curl_exec($curl);
  41. curl_close($curl);
  42. $stats = json_decode($result, true);
  43. foreach ($stats as $key => $value) {
  44. echo "Address: {$key} <br/>";
  45. echo "Number of clicks: {$value['clicks']} <br/>";
  46. echo "Earnings: {$value['earnings']} <br/><br/>";
  47. }

comments powered by Disqus