Advertisement
Guest User

Untitled

a guest
Apr 10th, 2020
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.46 KB | None | 0 0
  1. <?php
  2.  
  3. $URL='https://blockchain.info/ru/ticker';
  4.  
  5. $ch = curl_init();
  6. curl_setopt($ch, CURLOPT_URL,$URL);
  7. curl_setopt($ch, CURLOPT_TIMEOUT, 30); //timeout after 30 seconds
  8. curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
  9. curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
  10. $result=curl_exec ($ch);
  11. $status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);   //get status code
  12. curl_close ($ch);
  13.  
  14. $currencies=json_decode($result,true);
  15. print_r($currencies['USD']['last']);
  16. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement