Thanks!
<?php
$edigg_url = "/EDIGG";
$edigg_plus = "/EDIGGPLUS";
$user_role = "TEST"; // wait Digg authorization
function getStories($topic){
$url = "http://services.digg.com/stories/topic/$topic/upcoming?appkey=YOUR_APPKEY_DATA"; // READ_DIGG API DOC
if (!($digg = fopen($url, "r"))) {
return false;
}
while (!feof($digg)) {
$data .= fgets($digg);
}
fclose($digg);
if (!($xml = new SimpleXMLElement($data))) {
return false;
}
return $xml;
}
function user_has_role($role, $user = NULL) {
if ($user == NULL) {
global $user;
}
if (is_array($user->roles) && in_array($role, array_values($user->roles))) {
return TRUE;
}
return FALSE;
}
ini_set('user_agent', 'Trallallà/1.0');
print "window.setTimeout(\"window.location.href = '$edigg_url'\",50000);\n";
$tech = getStories("tech_news");
$hw = getStories("hardware");
if ($tech != false && $hw != false) {
for ($i=0; $i<6; $i++) {
if ($i % 2 == 0)
$story = $tech->story[$i/2];
else
$story = $hw->story[($i-1)/2];
$date = $story['submit_date'];
settype($date, int);
|