Archived
1
0
This repository has been archived on 2020-12-10. You can view files and clone it, but cannot push or open issues or pull requests.
old/application/models/TwitchModel.php
2018-10-16 18:28:42 +02:00

48 lines
1.4 KiB
PHP

<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class TwitchModel extends CI_Model {
public function getTwitchInfos($channel) {
$url = "https://api.twitch.tv/helix/users?login=" . $channel;
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'client-id: e4iys1e969ndfyrdzuiae7whaact2p'
]);
curl_setopt($ch, CURLOPT_URL,$url);
$result=curl_exec($ch);
curl_close($ch);
return json_decode($result, true);
}
public function getTwitchStream($channel) {
$url = "https://api.twitch.tv/kraken/streams/" . $channel;
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL,$url);
$result=curl_exec($ch);
curl_close($ch);
return json_decode($result, true);
}
public function getTwitchVideos($channel) {
$url = "https://api.twitch.tv/kraken/channels/" . $channel . "/videos";
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL,$url);
$result=curl_exec($ch);
curl_close($ch);
return json_decode($result, true);
}
}