Main Stories
Slash Boxes

Slash Open Source Project

Slashcode Log In

Log In

[ Create a new account ]

Formkeys

posted by CaptTofu on 09:18 AM June 21st, 2000   Printer-friendly   Email story
amccague writes "I need to be able to get formkeys offline. I'm running submit.pl in the offline version so I can automate the submission process. The plan is to have a program go online and get stories to post then automatically run them through submit.pl so all I'll have to do is approve them. THe problem is finding a new formkey for each time I run it. Ideas?"
This discussion has been archived. No new comments can be posted.
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login
Loading... please wait.
  • Are you submitting the submit button (the 'op' parameter)? submit.pl uses that to decide whether your request has been previewed and stuff, and it requires you to preview once.
    --
    global = useless
  • this line works. $I{F}{formkey} = getFormkey(); so now i can get a formkey but im still having issues with getting the stories to submit, anyother little bugs i might be forgetting?
  • basically what ive been trying is to write a perl script using command line functions passing to submit.pl the relevant name/values pairs. Ive been able to generate a formkey but i dont know enough about how the database is set up to use it. Ive tried breaking it up and first running from the command line `./submit.pl from=andrew email=calboy78\@nupedia.com subj=ThiSTest tid=ElectionFinance section=articlesstory=ThisBetterWork op=PreviewStory`; Then after having submit.pl write out the formkey to file i grab it and run this command. `./submit.pl from=andrew email=calboy78\@nupedia.com subj=ThiSTest tid=ElectionFinance section=articles story=ThisBetterWork op=SubmitStory formkey=THEVALUEIGRABFROMFILE`; This still doesnt work. Im trying now to just enter it directly into the database. Let me know if you have ideas.
  • This is what im doing now. And something is still now working. I dont think i know enough about databases to get it to work yet. #FIRST I RUN IT AS THOUGH IT WERE PREVIEW MODE `./submit.pl from=andrew email=calboy78\@nupedia.com subj=ThiSTest tid=ElectionFinance section=articlesstory=ThisBetterWork op=PreviewStory`; # formkey=$I{F}{formkey}`; #I GET THE FORMKEY OUT OF THE SCRIPT open(FMKY, "fmkholder") or die "cannot open file"; while ($line = ){ chomp; $fmky .= $line; } close(FMKY); #NOW WITH THE FORMKEY I RUN SUBMIT MODE `./submit.pl from=andrew email=calboy78\@nupedia.com subj=ThiSTest tid=ElectionFinance section=articles story=ThisBetterWork op=SubmitStory formkey=$I{F}{formkey}`; Not too much luck with this. Im working on putting it directly into the database, it might be easier. Andrew
  • why not just code some backend engine to put submissions into the submissions table? It'd be really easy to do. What process would feed it the stories? You just have to get the data into that table, and you'd be set.
  • I did tried adding them to the submission table which works fine. But i want it to be better than this, instead i want to submit it directly to the stories table, ive done this and it shows up in the list stories but wont show up on the front page yet. This is the final bug i hope. Clues on this?
  • It almost completely works. I submit it directly to the stories/newstories/storeistuff/discussions. The articles show up directly on the front page as i wanted. BUT, i noticed a bug in the comment section, these robotically written articles are not able to be commented, BAD. So im working on that next. Any ideas? Perhaps i need to submit the sid info to another database i dont know yet. Thanks for your info.
  • It doesn't work because you aren't passing the cookie. If you want a command line version to set this up, you'll have to look at using perl + ab and a temporary file, or hell, just use Perl and emulate the HTTP headers, and send your requests that way. There are several scripts out there in the wild that do this. I've done exactly what (I think you are looking to do and this was the problem. (Slash needs your UID to track the formkey, if you plan on posting as anonymous, then it will need your IP [and on