Advertisement
nfell2009

Untitled

Jan 2nd, 2017
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.43 KB | None | 0 0
  1. <?php
  2. $USERAGENT   = "Please change this!";
  3. $REQUEST_URL = "https://api.spiget.org/v2/resources/12345";
  4.  
  5. $options     = array('http' => array('user_agent' => $USERAGENT));
  6. $context     = stream_context_create($options);
  7. $response    = @file_get_contents($REQUEST_URL, false, $context);
  8.  
  9. if(!isset($response) || is_null($response)) {
  10.   // error handling
  11. }
  12.  
  13. $data = json_decode($response, true);
  14. // TODO: process data
  15. print_r($data);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement