-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopenforum_test.php
More file actions
37 lines (34 loc) · 903 Bytes
/
Copy pathopenforum_test.php
File metadata and controls
37 lines (34 loc) · 903 Bytes
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
<html>
<body>
<table class="openforum"><tr class="openforumheader"></tr>
<?php
$selector = $_GET["type"];
switch($selector){
case "most-viewed":
case "most-shared":
case "most-commented":
case "most-recent":
break;
default:
$selector = "most-recent";
}
$ch = curl_init("http://api.openforum.com/v1/summaries/$selector?apikey=5q2evymkx53dwzumv73adv4p&count=10");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
preg_replace('/%u([a-fA-F0-9]{4})/', '&#x\\1;', $output);
curl_close($ch);
$data = simplexml_load_string($output);
foreach($data->ReturnItems->Content as $index => $info){
echo "<tr class='openforumitem'>
<td class='openforumtitle'>
<a href='http://www.openforum.com{$info->LinkUrl}'>$info->Title</a>
";
if ($selector == "most-recent"){
echo "<p class='openforumtext'> $info->TeaserText </p>";
}
echo "</td></tr>";
}
?>
</table>
</body>
</html>