| Comments: |
I'm interested in setting this up, but I've got a question: What number goes in the "out_blog_id" field?
it's irrelevant, as long as the login information is correct. i'd put "1", though.
Not to be a bother, but I've been encountering an error:
results:Running at Fri Jun 16 13:18:31 2006 GMT Fetched 1 items. posting error was: syntax error postLJResponse : Something went wrong - 101 : Invalid password at /home/joshuas/utilities/dohour line 81
The username and password I've entered is correct, the link I provided is correct, my server CAN run PHP, etc. I'm not quite sure what the problem is, and attempting to solve it on my own is becoming quite irritating as it takes an hour to see whether the change worked or not.
What the app does is construct an MD5 hash of the handshake hash LJ sends it and your password. Now, I am not exactly sure what is going on here, as this does no altering of your password beyond creating the hash. Can you tell me what version of PHP you're running? Does your password contain any non-numerical or non-alphabetic passwords (I don't think this would matter, but it is something I have not deliberately checked against yet)? The current way I get debug output is for it to connect to an SQL server and leave a copy of information there. In either case, I added some extra debugging output for the script to display on this error, so maybe we can solve this together. http://web.njit.edu/~js84/php/delicious-glue.zip
what version of PHP you're running PHP Version 4.4.2.
Does your password contain any non-numerical or non-alphabetic passwords No, only letters and numbers.
In either case, I added some extra debugging output for the script to display on this error, so maybe we can solve this together. Alright, I uploaded it. I assume I just wait for del.icio.us to do it's next daily blog update?
yeah, this was one of the main problems I had when developing it, I had to wait all day to capture output, it is annoying
I think I figured out the problem: My main username starts with a "0", and apparently, when going through the scripts, it omits the "0", only leaving the second half. So, that might need to be corrected (unless it's an error on del.icio.us's side).
All right, it works now. Thanks.
how to use script ???
upluad and run ?
see - XML-RPC server accepts POST requests only.
how to configure ?
![[User Picture]](http://l-userpic.livejournal.com/54661135/1237682) | From: aileron 2006-10-01 03:47 am (UTC)
this is great! | (Link)
|
thank you! i've been waiting for something like this for a long time.
i was also wondering whether there's a way to format the post via the php end, particularly to insert the <lj-raw> tag at the beginning of the post.
![[User Picture]](http://l-userpic.livejournal.com/42846666/1212913) | From: nounverb 2006-10-02 02:52 am (UTC)
Re: this is great! | (Link)
|
You can edit this into the script, I don't have the code on me right now, however, you can easily prepend or append this. The variable you edit is $junk, which is just the XML of the post.
![[User Picture]](http://l-userpic.livejournal.com/54661135/1237682) | From: aileron 2006-10-02 08:31 am (UTC)
no more extra line breaks! | (Link)
|
thanks again. i added
$junk=ereg_replace("<ul class=\"delicious\">", "<lj-raw><ul class=\"delicious\">", $junk);
i'm sure there's another way but this worked for me.
how can i post friends-only post with this script? it is something in 'props' parameter of struct that goes as part of $response to LJ.XMLRPC.postevent, but i couldn't find how can this be done. can you help?
Did anyone ever determine how to do this?
Sorry it's been awhile since I've had to work on this or the LJ API. I can take a look at it sometime soon.
Thanks, I appreciate it. It's a great script, and this would make it even better.
if you want to do something right, do it yourself.
function constructResponse($username,$safeword,$results,$postdata)
{
// This is where you can reformat post information and set privacy levels.
// I should make this more usable at the expense of "good" code.
// Change the 'taglist' to change the tags the client uses.
$options =
array(
'taglist'=>"links"
);
$event = $postdata;
$year = date('Y');
$mon = date('n');
$day = date('j');
$hour = date('G');
$min = date('i');
$subject = 'Links for '.$day.'-'.$mon.'-'.$year;
$security = 'usemask';
$allowmask = '1';
$r =
array(
'username'=>$username,
'auth_method' => 'challenge',
'auth_challenge' => $results['challenge'],
'auth_response' => $safeword,
'event' => $event,
'subject' => $subject,
"security" => utf8_encode( $security ),
"allowmask" => utf8_encode( $allowmask ),
'year' => $year,
'mon' => $mon,
'day' => $day,
'hour' => $hour,
'min' => $min,
'ver' => '1',
'props' => $options
);
Yes, I saw that in the code. However, my knowledge of PHP is limited to modifying other people's "if x, then print y" statements, so I don't know what to _do_ with it.
just add strings marked with bold to function constructResponse, and posts will be "friends only". it is a very simple task.
Ah. Thank you, I hadn't understood that from your prior comment. I appreciate the help.
don't forget ver string, it won't work without it.
That did it, thanks very much.
Just to add to your help, here's what to add to post to communities.
In the first set of lines that begin with $, add
$posttojournal = 'comm-name-here';
replacing comm-name-here with the name of a community you have posting access to.
In the second set of lines, add
'usejournal' => $posttojournal,
I've tested this in a sandbox comm and it works.
this is useful, thank you. though i only auto-post to my own journal, this gives interesting opportunities :)
No problem. Thanks for giving me the idea where to look--I wanted to use this to do something like this without so much hand-coding: http://community.livejournal.com/readercon/274.html (And if I figure out lj-cuts, I'll report back here too . . . Or, more likely, come crawling back asking for help.)
you mean lj-cut that covers autopost? you want to autopost lj-cutted messages?
Yup. Regular lj-cuts I can manage. => I've tried nounverb's suggestion at the bottom of comments to this post, which has a typo somewhere and caused the script to throw an error message about unenclosed or unexpected variables (I foolishly didn't write it down). My best guesses at similar or related fixes haven't worked, but delicious didn't throw any error messages, just said it was a new job and hadn't run yet, several hours after the time for it to run. For the moment, I give up; I can always add lj-cuts by hand, after all.
well, right now del.icio.us giving me error 500 on any actions (adding, settings), but i added "lj-cut" to script on my server, and if it works, i will help you again :)
adding lj-cut was easy thing (like i thought), and the whole function: (all strings i've added to this function are bold)
function constructResponse($username,$safeword,$results,$postdata)
{
// This is where you can reformat post information and set privacy levels.
// I should make this more usable at the expense of "good" code.
// Change the 'taglist' to change the tags the client uses.
$options =
array(
'taglist'=>"links"
);
$postdata = "<lj-cut text=\"texthere\">" . $postdata . "</lj-cut>";
$event = $postdata;
$year = date('Y');
$mon = date('n');
$day = date('j');
$hour = date('G');
$min = date('i');
$subject = 'Links for '.$day.'-'.$mon.'-'.$year;
$security = 'usemask';
$allowmask = '1';
$r =
array(
'username'=>$username,
'auth_method' => 'challenge',
'auth_challenge' => $results['challenge'],
'auth_response' => $safeword,
'event' => $event,
'subject' => $subject,
"security" => utf8_encode( $security ),
"allowmask" => utf8_encode( $allowmask ),
'year' => $year,
'mon' => $mon,
'day' => $day,
'hour' => $hour,
'min' => $min,
'ver' => '1',
'props' => $options
);
return $r;
}
Thanks again, it worked great! I really appreciate it.
(And now I can add something else to the start & end of the post if I want, with your model--so double bonus.)
from this point i think you have everything to do anything with posts :)
Well thanks so much, I'll ad this in when I can
Hi, I'm really excited about this script... I've set it up to try it out and will let you know how it goes. I do have a question-- any way to set the script to automatically either set the links behind a lj-cut tag (so you don't spam your flist with the 98348758 links you happened to tag that day) or to automatically set a filter for the post to go to? Thanks!
Mmm yeah, in one of the regular expressions you could probably add the lj-cut tag. I've kind of dropped this project for a little bit while learning Python but I will see if there is some way I can make it more modular.
You could add a line right above 94 to:
$junk = "&lgt;lj-cut text=\"links\">
And then change line 94 to $junk .= $args[3]['description']
or something like that
Thank you! I've uploaded a test version to try and will let you know how it goes... is there really supposed to be a . before the = in line 94, because otherwise I don't see a change to make on that line? Thanks so much for your help with this! | |