CREATE TABLE tweets (
id int unsigned not null PRIMARY KEY auto_increment,
published blob,
content blob,
link blob
);
####
You have an error in your SQL Syntax; check the manual that corresponds with your MYSQL server version to use near 's Nuclear Security Summit -- focusing on solutions top keep nuclear materials away
####
#!/usr/bin/perl
use warnings;
use strict;
use XML::RSS;
use LWP::Simple;
use DBI;
my $user="root";
my $password="root";
my $database="forex";
# Connect to the database.
my $dbh = DBI->connect("DBI:mysql:database=forex;host=localhost",
"root", "root",
{'RaiseError' => 1});
# Get the source file
my $source = get("http://twitter.com/statuses/user_timeline/813286.rss");
# Create a new XML:RSS object
my $rss = new XML::RSS (version => '2.0');
# Parse the file into the XML::RSS object
$rss->parse($source);
# For example print titles and links of each RSS item
foreach my $item (@{$rss->{'items'}})
{
my $published = $item->{'pubDate'};
my $content = $item->{'title'};
my $link = $item->{'link'};
#print $published . "\n";
#print $content . "\n";
#print $link . "\n\n";
my $sth=$dbh->prepare("INSERT INTO tweets (published, content, link) VALUES ('$published', '$content', '$link')");
$sth->execute();
}