FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
processing-docs/content/static/feeds/github.php at master · processing/processing-docs · GitHub
processing
processing-docs
Repository navigation
Code
Issues
3
(3)
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
processing-docs
/
content
/
static
/
feeds
/
github.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
42 lines (33 loc) · 1.14 KB
Breadcrumbs
processing-docs
/
content
/
static
/
feeds
/
github.php
Copy path
File metadata and controls
42 lines (33 loc) · 1.14 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
<?php
//cache the json file and only call again if interval exceeded
error_reporting
(
0
);
function
get_json
(
$
url
){
$
base
=
"
https://api.github.com/
"
;
$
curl
=
curl_init
();
curl_setopt
(
$
curl
,
CURLOPT_USERAGENT
,
'
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13
'
);
curl_setopt
(
$
curl
,
CURLOPT_URL
,
$
base
.
$
url
);
curl_setopt
(
$
curl
,
CURLOPT_RETURNTRANSFER
,
1
);
curl_setopt
(
$
curl
,
CURLOPT_SSL_VERIFYPEER
,
false
);
$
content
=
curl_exec
(
$
curl
);
curl_close
(
$
curl
);
return
$
content
;
}
$
feed
=
"
repos/processing/processing/commits
"
;
$
cache_file
=
dirname
(
__FILE__
).
'
/cache/
'
.
'
github-cache
'
;
$
modified
=
filemtime
(
$
cache_file
);
$
now
=
time
();
$
interval
=
600
;
// ten minutes
if
( !
$
modified
|| ( (
$
now
-
$
modified
) >
$
interval
) ) {
$
json
=
get_json
(
$
feed
);
if
(
$
json
) {
$
cache_static
=
fopen
(
$
cache_file
,
'
w
'
);
fwrite
(
$
cache_static
,
$
json
);
fclose
(
$
cache_static
);
}
}
header
(
'
Cache-Control: no-cache, must-revalidate
'
);
header
(
'
Expires: Mon, 26 Jul 1997 05:00:00 GMT
'
);
header
(
'
Content-type: application/json
'
);
$
json
=
file_get_contents
(
$
cache_file
);
echo
$
json
;
?>
Back
|
FazBrowse Home
|
New Git URL