Page Menu
Home
Wolfplex
Search
Configure Global Search
Log In
Files
F441294
index.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1008 B
Subscribers
None
index.php
View Options
<?php
/**
* Gets the pads
*
* @return Array the pads list
*/
function
get_pads
()
{
//TODO: move API key in config
$url
=
"http://pad.wolfplex.org/api/1.2.1/listAllPads?apikey=U67yKTUDzz19fEHyrAuNN4zUnKxbOJZu"
;
$api_reply
=
json_decode
(
file_get_contents
(
$url
));
if
(
$api_reply
->
code
==
0
)
{
return
$api_reply
->
data
->
padIDs
;
}
throw
new
Exception
(
"API fatal error: $api_reply->message"
);
}
$format
=
array_key_exists
(
'format'
,
$_GET
)
?
$_GET
[
'format'
]
:
''
;
switch
(
$format
)
{
case
""
:
case
"json"
:
echo
json_encode
(
get_pads
());
break
;
case
"raw"
:
echo
implode
(
"
\n
"
,
get_pads
());
break
;
case
"txt"
:
header
(
"Content-Type: text/plain"
);
foreach
(
get_pads
()
as
$pad
)
{
echo
"* $pad
\n
"
;
}
break
;
default
:
die
(
"Unknown format: $format"
);
}
?>
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Jan 30, 1:26 AM (5 d, 16 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
71247
Default Alt Text
index.php (1008 B)
Attached To
rAPI Wolfplex API
Event Timeline
Log In to Comment