use WWW::Mechanize; $password = "******"; $url = "https://www.chess.com/login"; my $mech = WWW::Mechanize->new(); $cookie_jar = HTTP::Cookies->new( ); $mech->cookie_jar( $cookie_jar ); $mech->get($url); $mech->submit_form( form_id => "LoginForm", fields => { username=>"tenny", password => $password }, ); die "hmmm" unless ($mech->success); $mech->get("http://live.chess.comlive?v=2014060601"); $req = HTTP::Request->new(POST => 'http://live.chess.com/cometd/'); $req->header(Host=> 'live.chess.com', User-Agent=> 'Mozilla/5.0 (Windows NT 5.1; rv=>14.0) Gecko/20100101 Firefox/14.0.1', Accept=> '*/*', Accept-Language=> 'nl,en-us;q=0.7,en;q=0.3', Accept-Encoding=> 'gzip, deflate', Connection=> 'keep-alive', Content-Type=> 'application/json;charset=UTF-8', X-Requested-With=> 'XMLHttpRequest', Referer=> 'http://live.chess.com/live?v=2014060601', Content-Length=> 141, Cookie=> 'Cookie: chess_mw_c16=0; tf_login_id=tenny; cal=eGOaKyvdaqatJQ9o6eYICNuw2YJh2%2FunOUYdbS2Jrxf2zmZc7rH8GGGJNqW5%2Bu31tOygjDSTb%2BP8NpPiv3gqnLkVQvzCUvNcXH%2BuQ2pFHVfAYjBRZ0e0CBIUB%2BFji7OLsUTdGgXy3qN%2FXHBjMXncOmrFm9OikTOGaGsiboJNlHE%3D; PHPSESSID=ihirv1mdt9lhtl94c2jut4r3c5; BAYEUX_BROWSER=cf61583lxupwtz2yhwen1hjh2k6; __gads=ID=2810c673b5b73739:T=1402735047:S=ALNI_MZmG2Hxc2r0d4eiM4JMHXglgcofXg', Pragma=> 'no-cache', Cache-Control=> 'no-cache'); $req->content('{"channel":"/service/user","data":{"txt":"very bad connection today","id":"R1","sid":"cserv","tid":"Chat"},"id":"2730","clientId":"o"}'); $res = $mech->request($req); if ($res->is_success) { print $res->content; } else { print $res->status_line, "\n"; }