-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgithub.php
More file actions
48 lines (41 loc) · 1.39 KB
/
github.php
File metadata and controls
48 lines (41 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
// BryceBot's SSL proxy for the GitHub API
// Written to overcome the lack of SSL support in BryceBot
// Parameters: bot=, server=, user=, channel= -- Used to identify the source
// (cont'd): ghurl= The GitHub API URL to fetch
$start_time = microtime(true);
$useragent = "BryceBot-GitHub/1.0 (Bot: {$_REQUEST['bot']}@{$_REQUEST['server']}) (User: {$_REQUEST['nick']}@{$_REQUEST['channel']})";
$referer = "irc://{$_REQUEST['server']}/{$_REQUEST['channel']}";
if(!isset($_REQUEST['debug']))
$_REQUEST['debug'] = false;
if($_REQUEST['debug'])
echo "<pre>\n";
// cURL handle is global
$ch = curl_init();
curl_setopt_array($ch, array(
CURLOPT_AUTOREFERER => true,
CURLOPT_DNS_USE_GLOBAL_CACHE => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_FORBID_REUSE => false,
CURLOPT_FRESH_CONNECT => false,
CURLOPT_HEADER => false,
CURLOPT_HTTPGET => true,
//CURLOPT_MUTE => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CONNECTTIMEOUT => 2,
CURLOPT_PROTOCOLS => CURLPROTO_HTTP,
CURLOPT_REDIR_PROTOCOLS => CURLPROTO_HTTP,
CURLOPT_TIMEOUT => 3,
CURLOPT_ENCODING => "",
CURLOPT_INTERFACE => "ircbot.cobryce.com",
CURLOPT_REFERER => $referer,
CURLOPT_USERAGENT => $useragent,
));
curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt($ch, CURLOPT_URL, $_REQUEST['ghurl']);
$body = curl_exec($ch);
$json = json_decode($body);
if($_REQUEST['debug'])
var_dump(curl_getinfo($ch), $body, $json);
echo $body;
?>