Advertisement
patadejaguar

nexmo-get-balance.php

Jul 17th, 2015
377
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.97 KB | None | 0 0
  1. <?php
  2. /*
  3. get a amount of balance, nexmo api.
  4. use Guzzle
  5. http://www.opencorebanking.com/
  6. $GOpciones is a array with API credentials
  7. */
  8. include_once("../config.php");
  9.  
  10. require '../vendor/autoload.php';
  11.  
  12. use Guzzle\Http\Client;
  13. use Guzzle\Http\EntityBody;
  14. use Guzzle\Http\Message\Request;
  15. use Guzzle\Http\Message\Response;
  16.  
  17. $resultados             = array();
  18. $resultados["error"]    = true;
  19. $resultados["saldo"]    = 0;
  20.  
  21. $url        = "https://rest.nexmo.com/account/get-balance?api_key=" . $GOpciones["api_key"] . "&api_secret=" . $GOpciones["api_secret"];
  22. $filesave   = "/tmp/file.json";
  23. $cliente    = new Client();
  24.  
  25. $envio      = $cliente->get($url, array(), array("save_to" => $filesave));
  26. $envio->setHeader('Accept', 'application/json');
  27. $envio->send();
  28. $cnt        = file_get_contents($filesave);
  29.  
  30. //echo $envio->getResponse();
  31. //echo $envio->getResponse();
  32. header('Content-type: application/json');
  33. echo $cnt;
  34. //echo json_encode($envio->getResponse());
  35. //var_dump($envio->getResponse());
  36. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement