Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RSS module no longer working, can't understand why

Status
Not open for further replies.

1DMF

Programmer
Jan 18, 2005
8,795
GB
Hello,

We have had an RSS feed from another website working for literally years, all of a sudden it's stopped working.

Why would this have happened? If I go to the website / RSS URL it loads in my browser fine, what could be stopping the following code from working?

Code:
#######################
# Use Template Module #
#######################
use Template;        

##################
# Use RSS Module #
##################
use RSS;

##################
# Use LWP Module #
##################
use LWP::Simple;

my $i = -1;

# create new instance of XML::RSS for Mortgages
my $rss = new XML::RSS;

# Read current Mortgages XML RSS Feed
my $url = "[URL unfurl="true"]http://www.mortgages.co.uk/news/rss/latest.xml";[/URL]

$rss->parse(get $url);
 
# Set Array
my (@mornews);
                                           
# Loop RSS & create Array
foreach my $item (@{$rss->{'items'}}) {
    $i++;
    $mornews[$i]->{'title'} = $item->{'title'};
    $mornews[$i]->{'link'} = $item->{'link'};
}        
           
# Start template 
my $template = HTML::Template->new(  global_vars => 1,
                                            type => 'filename',
                                          source => DIR_TO_DOCS . '/templates/mortgage_news.htm',
                               die_on_bad_params => 0) or die "Cannot open mortgage_news.htm Template file: $!";

# Add variables to Template
$template->param( 'url_to_domain' => URL_TO_DOMAIN );
$template->param( 'url_to_cgi' => URL_TO_CGI );
$template->param( 'MortgageNews' => \@mornews );         

# print template    
print "Content-type: text/html\n\n";

print $template->output;  
     
exit();
it seems to hang on this line
Code:
$rss->parse(get $url);

All help appreciated.
1DMF

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"

Google Rank Extractor -> Perl beta with FusionCharts
 
Not sure if this helps but this is also causing errors in the Event Viewer
Event Type: Error
Event Source: W3SVC-WP
Event Category: None
Event ID: 2216
Date: 09/12/2009
Time: 11:15:32
User: N/A
Computer: OUR SERVER
Description:
The script started from the URL '/cgi-bin/mortgagenews.cgi' with parameters '' has not responded within the configured timeout period. The HTTP server is terminating the script.

For more information, see Help and Support Center at

What could have changed on the server or perhaps firewall which has started causing this error?

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"

Google Rank Extractor -> Perl beta with FusionCharts
 
I can confirm it was the LWP::Simple module.

i don't know why it just stopped working from 4/12/09 but I changed the LWP usage to
Code:
use LWP::Simple qw($ua get);

$ua->timeout(20);

and now it's working again. Anyone got any ideas why this has happened and why I had to alter the code to make it work again?

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"

Google Rank Extractor -> Perl beta with FusionCharts
 
Shot in the dark: maybe the server at was offline. LWP::Simple::get waits forever to get a page, unless you set a timeout like you did that makes it fail after 20 seconds.

Kirsle.net | My personal homepage
Code:
perl -e '$|=$i=1;print" oo\n<|>\n_|_";x:sleep$|;print"\b",$i++%2?"/":"_";goto x;'
 
Nope wasn't that, it wouldn't work on any of the XML feeds including our own.

I'm getting a sore head over this one! [banghead]

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"

Google Rank Extractor -> Perl beta with FusionCharts
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top