Андрей (palmindesert) wrote in lj_dev,
Андрей
palmindesert
lj_dev

XML-RPC posting into LJ

Hi, dear LJ developers! I'm creating a remote poster to LiveJournal for my site. This is the code i've wroute:

<?php
include ('IXR_Library.php');

$LjPass = $_POST['LjPass'];
$LjPassEncrypted = md5($LjPass);
$LjLogin = $_POST['LjLogin'];
$Auth = 'challenge';

$postSub = $_POST['postSub'];
$postText = $_POST['postText'];
$tags = array();
$postTime = $_POST['postTime'];
$postSecurity = $_POST['postSecurity'];

$LJ = new IXR_Client('http://www.livejournal.com/interface/xmlrpc');

if(!$LJ->query('LJ.XMLRPC.getchallenge')){
    echo 'Error!!!'.$ljClient->getErrorMessage();
}
else{
    $LjResponse = $LJ->getResponse();
    $LjChallenge = $LjResponse['challenge'];
    $ljContentToSend = array();
    $ljContentToSend['username'] = $LjLogin;
    $ljContentToSend['auth_method'] = 'challenge';
    $ljContentToSend['auth_response'] = md5($LjChallenge.md5($LjPass));
    $ljContentToSend['ver'] = '1';
    $ljContentToSend['event'] = $postText;
    $ljContentToSend['subject'] = $postSub;
    //date
    $ljContentToSend['year'] = $postTime['year'];
    $ljContentToSend['mon'] = $postTime['month'];
    $ljContentToSend['day'] = $postTime['day'];
    $ljContentToSend['hour'] = $postTime['hour'];
    $ljContentToSend['min'] = $postTime['minuts'];
    $ljContentToSend['props'] = array(
                                      'opt_preformated' => true,
                                      'opt_backdated' => true,
                                      'taglist' => $tags
                                      );
    $ljContentToSend['security'] = $postSecurity;
    echo '<br>';
    print_r ($ljContentToSend);
    echo'<br>';
   
    $LjMethod = 'LJ.XMLRPC.postevent';
   
    $LJ->query($LjMethod, $ljContentToSend);
   
    $LjResponse = $LJ->getResponse();
    print_r ($LjResponse);
    $LjError = $LJ->getErrorMessage();
    echo $LjError.'<br>';
    echo $LjSecurePass.'<br>';
    echo $ljContentToSend['auth_response'].'<br>';
    echo $LjPass.'<br>';
    echo $LjPassEncrypted.'<br>';
};
   
?>


Looks fine, but doesn't work :). Please, let me now, what's wrong?
Tags: *unanswered, client, client: php, client: posting, client: troubleshooting
Subscribe

  • cl-journal livejournal client

    Hey everyone, I'd like to present a livejournal client that I wrote to fulfill my needs but maybe there are other people that can find it…

  • SessionGenerate and ljloggedin

    Are there any information after release 86 and changes in cookies scheme to use sessiongenerate? It returns ljsession key, but this key is not enough…

  • Retrieving comments

    Hi, Is there a way to retrieve a list of comments made by user XXX (which may or may be not the currently logged in user) in the journals of users…

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 10 comments

  • cl-journal livejournal client

    Hey everyone, I'd like to present a livejournal client that I wrote to fulfill my needs but maybe there are other people that can find it…

  • SessionGenerate and ljloggedin

    Are there any information after release 86 and changes in cookies scheme to use sessiongenerate? It returns ljsession key, but this key is not enough…

  • Retrieving comments

    Hi, Is there a way to retrieve a list of comments made by user XXX (which may or may be not the currently logged in user) in the journals of users…