Oddly enough, I came home to find that one of my scripts is now broken, and nothing changed. It has been working for literally weeks, and all of a sudden, today it stopped. It's a simple code that gets the source of another webpage and picks what it needs out of it. Now I get a "400 Bad Request" error when I print the status line. The interesting thing is, I get this error when calling ANY website, not just the one I was using. Is it my hosting provider or am I missing something?
Like I said, it was working perfectly for weeks, and all of a sudden it just stopped. I did absolutely nothing to change the script.. I just visited the page and I'm greeted with a 400 error.
Code:
use LWP::UserAgent;
$ua = LWP::UserAgent->new;
$ua->agent("test (compatible) ");
my $req = HTTP::Request->new(GET => '[URL unfurl="true"]http://www.google.com');[/URL]
$req->content_type('text/html');
my $res = $ua->request($req);
print "Content-Type: text/html\n\n";
if ($res->is_success) {
$res->content;
print "<textarea rows=30 cols=30>";
print $res->content;
print "</textarea>\n\n";
} else {
print $res->status_line, "\n";
}