Advertisement
Guest User

Twitch API Usage

a guest
Feb 23rd, 2017
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.47 KB | None | 0 0
  1. $ch = curl_init("https://api.twitch.tv/kraken/user");
  2. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  3. curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
  4. curl_setopt($ch, CURLOPT_HTTPHEADER, array(
  5.     'Accept: application/vnd.twitchtv.v5+json',
  6.     'Client-ID: ' . TWITCH_API_KEY,
  7.     'Authorization: OAuth ' . $result['access_token']
  8. ));
  9.  
  10. $profileInfo = curl_exec($ch);
  11. if (curl_errno($ch)) {
  12.     echo 'Error:' . curl_error($ch);
  13. }
  14. curl_close($ch);
  15. var_dump($profileInfo);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement