Advertisement
Guest User

Untitled

a guest
Jul 30th, 2014
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. <?php
  2.  
  3. // CREDENTIALS AND INITIALISATION
  4.  
  5. $url = 'https://api.twitch.tv/kraken/channels/Harmo801/stream_key';
  6. $cookies_file = 'cookie.txt';
  7. if (!file_exists(realpath($cookies_file))) touch($cookies_file);
  8.  
  9. // CONNEXION
  10.  
  11. $ch = curl_init();
  12. curl_setopt($ch, CURLOPT_URL, $url);
  13. curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
  14. curl_setopt($ch, CURLOPT_HTTPHEADER, array("Accept: application/vnd.twitchtv.v3+json", "Authorization: OAuth h2326ng3rjaoa2qeio4ujum03efc8nr"));
  15. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  16. //curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
  17. curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1');
  18. //curl_setopt($ch, CURLOPT_COOKIEFILE, $cookies_file);
  19. //curl_setopt($ch, CURLOPT_COOKIEJAR, realpath($cookies_file));
  20. $resultat = curl_exec($ch);
  21. $http_status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
  22. curl_close($ch);
  23. var_dump($http_status);
  24.  
  25. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement