-
Notifications
You must be signed in to change notification settings - Fork 2
/
gp.php
27 lines (22 loc) · 854 Bytes
/
gp.php
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
<?php
function curlit( $githuburl ){
$curlheader = curl_init( );
curl_setopt( $curlheader, CURLOPT_URL, $githuburl );
curl_setopt( $curlheader, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)' );
curl_setopt( $curlheader, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt( $curlheader, CURLOPT_CONNECTTIMEOUT, 6 );
curl_setopt( $curlheader, CURLOPT_TIMEOUT, 6 );
return curl_exec($curlheader);
}
function downjson( $githuburl ){
return json_decode( curlit( $githuburl ) );
}
function downtxt( $githuburl ){
return curlit( $githuburl );
}
$ghurl = "https://api.github.com/repos/ecomp-shONgit/ecomparatio/contents/publicdumps?ref=master";
$res = downjson( $ghurl );
foreach( $res as $r ){
echo $r->{'name'}."#########".downtxt($r->{'download_url'})."###############";
}
?>