I'd recommend doing it in PERL. That way it could easily be ported to Windows.
I'm wondering if there is a simpler way to submit factors than having to open a browser and then go to www.seventeenorbust.com.
There must be some way to make a script in Linux that automaticly submits new factors to the text-field on the homepage and then presses the submit button.
I've been trying to google for at solution, but it's not easy to find the right words to google for. I've also been looking a bit on the man-pages of links and similar programs without much luck.
So if anyone's got an idea of which program I should use in the script it would be much appreciated.
I'd recommend doing it in PERL. That way it could easily be ported to Windows.
Joe O
Give wget a try -- it's available for lots of platforms. Remember to submit info on the login page as well if you're not always logged in though.
You'll want to POST factor data to /sieve/sievePost.mhtml. The factor field is called "factors", but look in the file yourself.
Login info should be POSTed to /login/loginPost.mhtml if you need it, with something like:
postdata = "-login=true&-username=" + urlencode( cfg_username ) + "&-password=" + urlencode( cfg_password );
I finally took a little time to read some man-pages
wget seem to be doing the job, thanks for the tip mKlasson
the following command is basicly what does it:
The cookies.txt file is taken from the cookie created by the web-site when you log in.Code:wget --load-cookies cookies.txt --post-file=fact.txt http://www.seventeenorbust.com/sieve/sievePost.mhtm
wget creates a sievePost.mhtml(.* if one already exist) file in which one can see the results of the sumbission (this avoided by the --delete-after tag)
For this to work I add factors= to the start of my fact.txt file and remove the '+1' at the end of each line of fact.txt.
For some reason wget won't submit the '+', i guess it's something with the format of strings in UNIX, but I haven't figured out what it is yet.
Any help on this little problem would be appreciated, I guess one could just make a little workaround script that removed the '+1' part of each line, but I there must be another way ...
Anways my plan is to cron this job when I leave my computer for longer periods so that I don't need to worry about factors not being submitted in timely fashion.
I guess I should also should write a little script to sort out which factors have been submitted, but as long as it's only for factoring and one just remember to remove older factors from fact.txt I guess the server load won't be all to big when I only let cron do the job every 24 hours.
The problem is that + is used to encode a blankspace. %XY can be used to encode any ASCII character by giving the hexadecimal code -- %2B corresponds to a normal plus sign.
well now I made my workaround using sed
It probably could be done in a nicer way, but it does the job.Code:sed {s/+/%2B/} fact.txt > submit.txt wget --load-cookies cookies.txt --post-file=submit.txt http://www.seventeenorbust.com/sieve/sievePost.mhtml rm submit.txt
Thanks for the help mklasson
Based on this discussion I've now made the following shell-script which submits any new factors:
It uses a little (often overlooked) utility called logtail to get the new factors, and then it's basically what Frodo42 did, except that I've created a custom cookies.txt that only contains the cookie from www.seventeenorbust.com.Code:#! /bin/sh rm submit.txt /usr/sbin/logtail fact.txt > new_factors.txt if [ -s new_factors.txt ]; then (echo 'factors='; cat new_factors.txt) | sed -e 's/\+/%2B/' > submit.txt; wget --load-cookies ~/17_or_bust/p-1/cookies.txt --post-file submit.txt http://www.seventeenorbust.com/sieve/sievePost.mhtml fi rm new_factors.txt
This is working out just fine, thanks hc_grove.
btw. logtail is in gentoo contained in the e-build logsentry or can be found on http://www.fourmilab.ch/webtools/logtail/