GetDotted Domains

Viewing Thread:
"my code isn't working"

The "Freeola Customer Forum" forum, which includes Retro Game Reviews, has been archived and is now read-only. You cannot post here or create a new thread or review on this forum.

Mon 12/02/07 at 12:46
Regular
"www.funrunner.co.uk"
Posts: 19
hey, i recently got some new code which is supposed to refresh the content from an RSS feed but it doesn't seem to be working. It works on other sites not hosted on freeola so i was thinking it may be the way they work it. I was wondering if someone could give it the once over and tell me if they can see anything:


//////////
// Update Sources
/////////

include ("functions/global.php");


////////////
// Get the table prefix
///////////

$prefix = GetPrefix(); // get the table prefix so we know which tables to use

////////////
// Make a connection to the database
////////////

$db = ConnectDb(); // get the database connection going from global.php

$ip = GetIP();

$time = time();

require_once 'fetch/rss_fetch.inc';

// get the time
$time = time();

// get the rss feeds from the database table 'feedsource'

$getSources = $db->query("SELECT * FROM ".$prefix."feedsource ORDER BY lastUpdate");
while ($rssFeeds = $db->fetch_array($getSources)) {

$url = "$rssFeeds[rssLocation]";
$rss = fetch_rss( $url );

foreach ($rss->items as $item) {

$href = $item['link'];
$title = addSlashes($item['title']);
$description = addslashes($item['description']);


// check to see if this feed has only just been added
if ($rssFeeds[lastUpdate]) {

$checkHeadlines = $db->query("SELECT * FROM ".$prefix."headlines WHERE link='$href'");


$checkRubbishedHeadlines = $db->query("SELECT * FROM ".$prefix."headlinerubbishbin WHERE link='$href'");


if($db->num_rows($checkHeadlines) > 0) { }
elseif($db->num_rows($checkRubbishedHeadlines) > 0) { }

else {

$db->unbuffered_query("INSERT INTO ".$prefix."headlines VALUES ('', '$title', '$description', '$href',

'$rssFeeds[id]', '$time', '0')");

}

} // end of if rssFeeds[lastupdate]

else {

$db->unbuffered_query("INSERT INTO ".$prefix."headlinerubbishbin VALUES ('', '$title', '$description', '$href',

'$rssFeeds[id]', '$time')");

$db->unbuffered_query("UPDATE ".$prefix."feedsource SET lastupdate='$time' WHERE (id=$rssFeeds[id])");

}

} // end of foreach rss item

} // end of while feedsource



?>
Mon 12/02/07 at 13:33
Regular
"Devil in disguise"
Posts: 3,151
Freeola dont allow external socket connections apparently, ie you wont be able to connect to rss feeds to retrieve them.
Mon 12/02/07 at 12:46
Regular
"www.funrunner.co.uk"
Posts: 19
hey, i recently got some new code which is supposed to refresh the content from an RSS feed but it doesn't seem to be working. It works on other sites not hosted on freeola so i was thinking it may be the way they work it. I was wondering if someone could give it the once over and tell me if they can see anything:


//////////
// Update Sources
/////////

include ("functions/global.php");


////////////
// Get the table prefix
///////////

$prefix = GetPrefix(); // get the table prefix so we know which tables to use

////////////
// Make a connection to the database
////////////

$db = ConnectDb(); // get the database connection going from global.php

$ip = GetIP();

$time = time();

require_once 'fetch/rss_fetch.inc';

// get the time
$time = time();

// get the rss feeds from the database table 'feedsource'

$getSources = $db->query("SELECT * FROM ".$prefix."feedsource ORDER BY lastUpdate");
while ($rssFeeds = $db->fetch_array($getSources)) {

$url = "$rssFeeds[rssLocation]";
$rss = fetch_rss( $url );

foreach ($rss->items as $item) {

$href = $item['link'];
$title = addSlashes($item['title']);
$description = addslashes($item['description']);


// check to see if this feed has only just been added
if ($rssFeeds[lastUpdate]) {

$checkHeadlines = $db->query("SELECT * FROM ".$prefix."headlines WHERE link='$href'");


$checkRubbishedHeadlines = $db->query("SELECT * FROM ".$prefix."headlinerubbishbin WHERE link='$href'");


if($db->num_rows($checkHeadlines) > 0) { }
elseif($db->num_rows($checkRubbishedHeadlines) > 0) { }

else {

$db->unbuffered_query("INSERT INTO ".$prefix."headlines VALUES ('', '$title', '$description', '$href',

'$rssFeeds[id]', '$time', '0')");

}

} // end of if rssFeeds[lastupdate]

else {

$db->unbuffered_query("INSERT INTO ".$prefix."headlinerubbishbin VALUES ('', '$title', '$description', '$href',

'$rssFeeds[id]', '$time')");

$db->unbuffered_query("UPDATE ".$prefix."feedsource SET lastupdate='$time' WHERE (id=$rssFeeds[id])");

}

} // end of foreach rss item

} // end of while feedsource



?>

Freeola & GetDotted are rated 5 Stars

Check out some of our customer reviews below:

Very pleased
Very pleased with the help given by your staff. They explained technical details in an easy way and were patient when providing information to a non expert like me.
I've been with Freeola for 14 years...
I've been with Freeola for 14 years now, and in that time you have proven time and time again to be a top-ranking internet service provider and unbeatable hosting service. Thank you.
Anthony

View More Reviews

Need some help? Give us a call on 01376 55 60 60

Go to Support Centre

It appears you are using an old browser, as such, some parts of the Freeola and Getdotted site will not work as intended. Using the latest version of your browser, or another browser such as Google Chrome, Mozilla Firefox, or Opera will provide a better, safer browsing experience for you.