Fearless O'Toole, Last British Columbian Pirate (kimera) wrote in lj_clients,
Fearless O'Toole, Last British Columbian Pirate
kimera
lj_clients

  • Mood:

HI...

(After mis-posting this to lj_dev...)

Can anyone tell me why (or point me in the right direction to the reason why) the following code...


#!/usr/bin/perl

use LWP 5.64;
use HTTP::Response;
use strict;

my $url = "http://www.livejournal.com/interface/flat";
my $ida;
my $passwd;
my $mode = "login";
my $entry;
my $newline;
my $browser = LWP::UserAgent->new;
my $response;

print "Enter your id: ";
$ida = <STDIN>;

print "Enter your password: ";
$passwd = <STDIN>;

print "Enter your text:\n";
while ($newline ne ".") {
	$newline = <STDIN>;
	$newline =~ s/\n//g;
	$entry = "$entry\r\n$newline";
}

$ida =~ s/\n//g;
$passwd =~ s/\n//g;
chop($entry);
$entry =~ s/([^A-Za-z0-9 ])/sprintf("%%%02lx", unpack("c",$1))/ge;
$entry =~ s/ /+/g;


$response = $browser->post ( $url,
	[
		'mode' => '\"$mode\"',
		'user' => '\"$ida\"',
		'password' => '\"$passwd\"',
		'event' => '\"$entry\"'
	],
);

print $response->content;

exit;


...gives me the following error...

errmsg
Client error: No username sent.
success
FAIL


I've looked at the Developer Area and I can't find a single reason that it can't get the username. I haven't dont the hexcoding for non-alphanumeric characters yet (I have done this at this point), but would that affect the basic post string? I'm not giving up, but I'm lost on where to look next. Any and all help would be appreciated -- and I apologize if this is bad protocol for a first post.
Subscribe
  • Post a new comment

    Error

    Comments allowed for members only

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

  • 6 comments