Advertisement
Guest User

Untitled

a guest
May 3rd, 2015
416
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. public function sub_length($access_token, $channel, $target) {
  2. $curl = curl_init();
  3. curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
  4. curl_setopt($curl, CURLOPT_HTTPHEADER, array(
  5. 'Authorization: OAuth '.$access_token
  6. ));
  7. curl_setopt($curl, CURLOPT_URL, $this->base_url.'channels/' . $channel . '/subscriptions/' . $target);
  8.  
  9. $output = curl_exec($curl);
  10. $response = json_decode($output, true);
  11. curl_close($curl);
  12.  
  13. if(isset($response['error'])) {
  14. $error = 'Unauthorized';
  15. return $error;
  16. } else {
  17. $total = $response['created_at'];
  18. return $total;
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement