Rob1 (forked) wrote in lj_clients,
Rob1
forked
lj_clients

I could really use some help with 'challenge-response'. I'm just trying to get a simple cross-post plugin working- using php and The Inutio XML-RPC Library. I surfed around enough to patch together a simple php script that posts- but I want to use the challenge-response method. Problem is, xml-rpc completely baffles me. Reading this post helped- at least in terms of what I know I need to add in:

"You need to send the user name, auth_method='challenge', auth_challenge=$challenge, and of course the auth_response." And generate the response via: md5($challenge . md5($password))

However, I've no clue how to put it all together. Here's what I have so far- it works to post, but as soon as I start playing with the 'challenge-response' stuff it breaks- I can't even get a challenge!


require_once('/lj/IXR_Library.inc.php');

$lj_userid = "username";
$lj_passwd = "password";
$lineendings = "pc";
$event = "Hm what to say";
$subject = "Subject what subject";
$timenow = getdate();
$year = date('Y');
$month = date('m');
$day = date('d');
$hour = date('H');
$minute = date('i');
$client = new IXR_client("www.journalfen.net", "/interface/xmlrpc", 80);
$client->debug = true;
$x_params_r = array( "username" => utf8_encode( $lj_userid ),
"password" => utf8_encode( $lj_passwd ),
"lineendings" => $lineendings,
"event" => utf8_encode( $event ),
"subject" => utf8_encode( $subject ),
"year" => utf8_encode( $year ),
"mon" => utf8_encode( $month ),
"day" => utf8_encode( $day ),
"hour" => utf8_encode( $hour ),
"min" => utf8_encode( $minute ));


$client->query('LJ.XMLRPC.postevent', $x_params_r);

Now when I used: LJ.XMLRPC.getchallenge, I do get the correct challenge, but I'm just not sure how to put it all together (or reply to the challenge!).

Anyway, if someone doesn't mind helping out an xml-rpc newbie, I'd be grateful. I've about hit the limit of my ability to figure this out, and I'd really rather use the challenge-response approach.
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

  • 4 comments