Advertisement
albin900

Untitled

Aug 27th, 2014
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.68 KB | None | 0 0
  1. <?php
  2. $username = $_GET["id"];
  3. $follows = $_GET["follows"];
  4.  
  5. function url($url) {
  6.     $ch = curl_init();
  7.     $timeout = 5;
  8.     curl_setopt($ch, CURLOPT_URL, $url);
  9.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  10.     curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
  11.     $data = curl_exec($ch);
  12.    
  13.     $code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
  14.    
  15.     curl_close($ch);
  16.    
  17.     return $code;
  18. }
  19.  
  20. if($username == "[username]"){
  21.     exit("Please specify a username");
  22. }
  23.  
  24. if($username == null ){
  25.     exit("Error: Username wrong");
  26. }
  27.  
  28. $answer = url("https://api.twitch.tv/kraken/users/" . $username . "/follows/channels/" . $follows);
  29.  
  30. if($answer == 200){
  31.     echo "true";
  32. }else{
  33.     echo "false";
  34. }
  35. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement