cURL upload script

Miscellaneous code snippets and examples that members have posted

cURL upload script

Postby ScratchMonkey » Mon Feb 19, 2007 8:03 pm

I needed to upload information to multiple guilds with different passwords. (I'm the "IT guy" in more than one guild.) UniUploader only has provision for one password. So I came up with this simple Windows batch file:

Code: Select all
set roster_url=http://www.myguildserver.com/roster/update.php
set guildpw=myguildpassword
set wow_account=mywowaccount
set wow_path="c:\program files\world of warcraft"
gzip --stdout %wow_path%\wtf\Account\%wow_account%\SavedVariables\CharacterProfiler.lua > %temp%\CharacterProfiler.lua.gz
curl -F CharacterProfiler=@%temp%\CharacterProfiler.lua.gz -F password=%guildpw% -F submit=Upload %roster_url%


You can copy and paste the curl command line to upload to more than one guild server, each with its own password. Or leave the password blank if you're not authorized to update the member list.

Enhancements welcome.

cURL binaries can be downloaded here:

http://curl.haxx.se/

gzip binaries (for faster uploads) can be found here:

http://www.gzip.org/
Last edited by ScratchMonkey on Mon Feb 19, 2007 8:06 pm, edited 2 times in total.
User avatar
ScratchMonkey
WR.net Expert
WR.net Expert
 
Posts: 212
Joined: Wed Jul 05, 2006 4:32 pm
Location: San Pablo, CA

cURL upload script

Postby Potpie » Tue Apr 10, 2007 11:17 am

Curl Rocks!

I have made a zip package that contains the CharacterProfiler game addon, curl.exe, and a batch file that guildmates can use to launch the game or put in their Scheduled Tasks for automatic "Set it and Forget it" uploading.

It's very simple for me to maintain, and is very simple for my guild to use.

I host, administer, implement, fix, break, etc. all web resources for the guild - for 2+ years now. vBulletin, various vB mods and plugins, WoWRoster, etc.

It's been fun - the hardest part is getting people to upload their characters to the roster. Curl has really been the best for that.
User avatar
Potpie
WR.net Apprentice
WR.net Apprentice
 
Posts: 18
Joined: Tue Jul 04, 2006 11:45 pm

cURL upload script

Postby ScratchMonkey » Tue Apr 10, 2007 10:59 pm

If you also use Allakhazam's WoWReader to upload profiles and other collected data to Allakhazam, you can add this to your cURL upload script.

wr2-upload.cmd

Code: Select all
set wow_account=xxxxxx
set wow_path="c:/games/wow"
set wr2_login_url=http://wow.allakhazam.com/cgi-bin/user.pl
set wr2_upload_url=http://wow.allakhazam.com/cluster/uplua.pl
set wr2_user=yyyyyy
set wr2_password=zzzzzz
curl -c %temp%/allahcookies.txt -d "un=%wr2_user%&x=m&pw=%wr2_password%&pt=1" %wr2_login_url%
curl -b %temp%/allahcookies.txt -F sv=@%wow_path%/wtf/Account/%wow_account%/SavedVariables/Wr2.lua -F submit=Upload %wr2_upload_url%


Replace xxxxxx, yyyyyy, and zzzzzz with your own account data, and change the wow_path variable to match where you installed the game.
User avatar
ScratchMonkey
WR.net Expert
WR.net Expert
 
Posts: 212
Joined: Wed Jul 05, 2006 4:32 pm
Location: San Pablo, CA

Re: cURL upload script

Postby Potpie » Thu Apr 12, 2007 3:24 am

I've been a paid subscriber to AK since EQ1 but never uploaded to it.

I will now though, thanks Monkey! :thumleft:
User avatar
Potpie
WR.net Apprentice
WR.net Apprentice
 
Posts: 18
Joined: Tue Jul 04, 2006 11:45 pm

cURL upload script

Postby Sansalas » Fri Dec 28, 2007 12:39 am

Code: Select all
hm don't seem to work for me

power-mac-g5:Desktop user$ ./cp-update.sh

-=[ Do 27 Dez 2007 16:37:01 CET

-=[ Compressing character information...

  done.

-=[ Uploading character information to http://scanningsdone.de/wow/index.php?p=update...

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 66021    0 21016  100 45005  17321  37093  0:00:01  0:00:01 --:--:-- 38172

  response received from server.

-=[ Results...


power-mac-g5:Desktop user$


Then I have reloaded the page (empty cache also). but no info about an update :/
Last edited by Sansalas on Fri Dec 28, 2007 12:40 am, edited 1 time in total.
User avatar
Sansalas
WR.net Apprentice
WR.net Apprentice
 
Posts: 4
Joined: Thu Dec 27, 2007 3:34 am

cURL upload script

Postby Sansalas » Fri Dec 28, 2007 12:56 am

hm I guess I know the reason for it.... no password is given!

how do I implement it in the code, plz?
User avatar
Sansalas
WR.net Apprentice
WR.net Apprentice
 
Posts: 4
Joined: Thu Dec 27, 2007 3:34 am

Re: cURL upload script

Postby tuigii » Fri Dec 28, 2007 4:21 pm

Hummm.

No-one but you can answer that question.

Start with showing your script :D
Really, it helps when one excopses a max of details before asking questions.

For starters : I'm one of those that doesn't use a Mac (I'm not saying that I'm happy about ^^ - I love Mac's)

What I know, is that Unix (the base latest Mac OS's) can do stuff that still has to be invented - Vista, for example, includes a command line interface that starts to look like sh. Remember, we are in 2007 :D

What I tend to say, is that the dos/windows batch code (look at the first post) and you Unix-Mac-Os shell script are globally the the same thing.

So, you'll have to put in 'somewhere' the passsword on the command that actually sends your compressed CP.lua file to the server. It's as easy as that.

Grab a copy of the source of UniUpLoader to see how they did it.
User avatar
tuigii
WR.net Master
WR.net Master
 
Posts: 891
Joined: Wed Dec 27, 2006 12:57 pm
Location: Somewhere in the South Ouest of France

Re: cURL upload script

Postby ScratchMonkey » Fri Dec 28, 2007 10:34 pm

tuigii wrote:What I know, is that Unix (the base latest Mac OS's) can do stuff that still has to be invented - Vista, for example, includes a command line interface that starts to look like sh. Remember, we are in 2007 :D


Windows does have a fancy scripting language, but it's not a shell. Few but administrators know about it.

http://www.microsoft.com/technet/script ... fault.mspx

Or you can download Perl for free and script in that. :D

http://activestate.com/Products/activeperl/
Last edited by ScratchMonkey on Fri Dec 28, 2007 10:34 pm, edited 1 time in total.
User avatar
ScratchMonkey
WR.net Expert
WR.net Expert
 
Posts: 212
Joined: Wed Jul 05, 2006 4:32 pm
Location: San Pablo, CA

cURL upload script

Postby PleegWat » Fri Dec 28, 2007 11:21 pm

Powershell can compete with sh in my opinion. It's got weak points compared to sh, but it has strong points as well. The main problem with it is that it is not shipped with the OS, so you can't count on it to always be available.

Oh, and powershell most definitely is a shell.
I <3 /bin/bash
User avatar
PleegWat
WoWRoster.net Dev Team
WoWRoster.net Dev Team
 
Posts: 1636
Joined: Tue Jul 04, 2006 1:43 pm


Return to Code Cache

Who is online

Users browsing this forum: No registered users and 0 guests

cron