Hi all, I've been using a Perl script for a couple of years to retrieve FaceBook event listings. It's worked fine until the last couple of months, and I'm very often getting this message:
Status read failed: A non-blocking socket operation could not be completed immediately. at C:/Strawberry/perl/vendor/lib/Net/HTTP/Methods.pm line 276.
I've searched around and couldn't find anything that explains what this means or what to do about it. Oddly, once in a while the script still works.
Here's a bit of my login code. I'm running on Windows 7 with Strawberry Perl v5.20.2.
use CGI;
use File::Basename;
use LWP::UserAgent;
use strict;
my %postLoginData; #necessary post data for login
$postLoginData{'email'}=$email;
$postLoginData{'pass'}=$password;
$postLoginData{'persistent'}=1;
$postLoginData{'login'}='Login';
our $response; #holds the response the HTTP requests
#set the headers, let's make this a Firefox browser!
our @header = ('Referer'=>'http://www.facebook.com', 'User-Agent'=>$us
+er_agent);
our $cookie_jar = HTTP::Cookies->new(file=>'fbkCookies.dat',autosave=>
+1, ignore_discard=>1);
our $browser = LWP::UserAgent->new; #init browser
$browser->cookie_jar($cookie_jar);
print " getting fb login...\n";
$browser->get('http://www.facebook.com/login.php',@header);
print " posting login request...\n";
#here we actually login!
$response = $browser->post('https://login.facebook.com/login.php',\%po
+stLoginData,@header);
#was login successful?
if($response->content =~ /Incorrect Email/)
{
print "Login Failed...Quitting..\n";
exit;
}
else {
print "..and we are in!\n\n";
#let's go to the homepage
my $pageresponse = $browser->get( $url ,@header);
# this is where the error appears:
print $$pageresponse{_content};
I know there are FB modules out there that probably work better, but I'd like to understand what's happening here, if anyone has seen it before. Many thanks!