Advertisement
yogasmara

Untitled

Aug 13th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.76 KB | None | 0 0
  1. <?php
  2.   header("user-key : 417e013d16933908dab0a30ca8fb5d50",
  3.         "accept : application/json"
  4.   );
  5.  
  6. $service_url = 'https://api-endpoint.igdb.com';
  7. $curl = curl_init($service_url);
  8. curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  9. $curl_response = curl_exec($curl);
  10. if ($curl_response === false) {
  11.     $info = curl_getinfo($curl);
  12.     curl_close($curl);
  13.     die('error occured during curl exec. Additioanl info: ' . var_export($info));
  14. }
  15.  
  16. curl_close($curl);
  17. $decoded1 = json_decode($curl_response,true);
  18. if (isset($decoded1->response->status) && $decoded1->response->status == 'ERROR') {
  19.     die('error occured: ' . $decoded1->response->errormessage);
  20. }
  21. echo 'response ok!';
  22. $dumbstr = var_export($decoded1->response);
  23. print_r($curl_response);
  24. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement