1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
#!/usr/bin/perl use LWP::UserAgent; use XML::RSS; # Settings my $rss1 = "http://www.dieter-broers.de/blog.xml"; # Valid XML-RSS - W3C-syntax-checker - does not work! my $rss2 = "http://www.gedankendoping.de/feed"; # Also valid - does work? # Load data my $ua = LWP::UserAgent->new(); my $response = $ua->get($rss2); # Change here to $rss1 and the error will appear... my $ticker=$response->content(); # Parse RSS my $rss = XML::RSS->new(encoding=>'utf-8'); $rss->parse($ticker); # Output foreach $item (@{$rss->{'items'}}) { my $title = $item->{'title'}; print($title."\n"); }
$rss->parsefile('blog.xml');
die $ticker;
1
2
3
4
5
6
7
<html>
<head><title>403 Forbidden</title></head>
<body bgcolor="white">
<center><h1>403 Forbidden</h1></center>
<hr><center>nginx</center>
</body>
</html>
$ua->agent('Opera'); # oder anderen existenten Useragent