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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting 400 Bad Request from a script that worked YESTERDAY

Status
Not open for further replies.

Supra

Programmer
Dec 6, 2000
422
US
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?
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";
}
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.
 
call or contact your host and ask them.

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
I just wanted to see if anyone had that happen before, and if they knew offhand maybe why. But an hour after I posted this, it started working again magically. I'm still curious as to why that would happen, but at least it works. Thanks anyway!
 
Happens all the time.

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top