Custom "source" fields in Laconica posts using Curl
Some of my friends on the Twit Army have been asking how I was able to override the source string when posting microblogs. Here's an example of what I mean.
This is a normal post from the web

Notice that it says "from web".
This is a post from curl with the custom source

In this case it's "from a land down under ♫"
This is easily done with the command line tool "Curl" and the Laconica API
Posting from Windows
- Download Curl for Windows here .
- Extract to a folder of your choice. I'll use C:\curl for simplicity.
- Click Start -> Run and enter "cmd" in the run window to open a command prompt.
- From the command prompt type
cd C:\curl. You should now be in theC:\curl>directory. - Type:
curl.exe "http://army.twit.tv/api/statuses/update.xml" -u {username}:{password} -d "status={your message to post}&source={your custom source}"
replacing the fields in curly braces { } with your own data.
For example:
curl.exe "http://army.twit.tv/api/statuses/update.xml" -u kylehase:supersecret -d "status=Watching FamilyGuy. Peter just lost a finger.&source=my couch"
That's it. I'll update this post later to explain how to add the curl command to %PATH% on Windows and use a scripts to make posting even easier.
Posting from Linux or OSX
Unix based operating systems usually come with Curl. If not, you should be able to get it via yum or apt-get curl from your distro repository. After that, simply run the same command from above without the .exe extension.
curl "http://army.twit.tv/api/statuses/update.xml" -u kylehase:supersecret -d "status=Eating muffins&source=Kitchen table"
Update 1 - Batch script
Here's a quick and dirty batch script I wrote up for Windows. Save it as a .bat file in the same directory as curl.exe and change the username and password to your own. Password is obviously not encrypted so be careful.
rem Place this script in the same directory as curl.exe.
rem Change the username and pass to your username and pass
SET user=yourname
SET pass=yourpass
rem Change this line only if you're using a different instance of Laconica
SET api="http://army.twit.tv/api/statuses/update.xml"
rem == Shouldn't need to change anything below here ==
SET /P status="Status (140): "
SET /P source="Source (32): "
curl.exe %api% -u %user%:%pass% -d "status=%status%&source=%source%"
SET user=
SET pass=
SET api=
SET status=
SET source=
pause


