Difference between revisions of "SNDTWTMSG"

From MidrangeWiki
Jump to: navigation, search
(hide password parm contents)
(Changed to use consistent operators when constructing &CMD)
Line 10: Line 10:
 
             DCL        VAR(&CMD) TYPE(*CHAR) LEN(300)
 
             DCL        VAR(&CMD) TYPE(*CHAR) LEN(300)
 
             CHGVAR    VAR(&CMD) VALUE('/installedApps/curl/curl --basic +
 
             CHGVAR    VAR(&CMD) VALUE('/installedApps/curl/curl --basic +
                           --user ' || &USER *TCAT ':' || &PASS *TCAT ' +
+
                           --user ' || &USER |< ':' || &PASS |< ' +
                           --data status="' || &TWEET *TCAT '" +
+
                           --data status="' || &TWEET |< '" +
 
                           http://twitter.com/statuses/update.xml')
 
                           http://twitter.com/statuses/update.xml')
 
             QSH        CMD(&CMD)
 
             QSH        CMD(&CMD)

Revision as of 15:45, 24 April 2009

Want a simple and free way to send a message to Twitter from your System i? Here you go. I am releasing this as an Open Source release. Please improve on the coding and update this page with your changes.

You will need the AIX binary of cURL from here. You will need version 7.13.1. Once extracted, put the curl object into a folder on the IFS.

SNDTWTMSG.CLLE

            PGM        PARM(&USER &PASS &TWEET)
            DCL        VAR(&USER) TYPE(*CHAR) LEN(30)
            DCL        VAR(&PASS) TYPE(*CHAR) LEN(30)
            DCL        VAR(&TWEET) TYPE(*CHAR) LEN(140)
            DCL        VAR(&CMD) TYPE(*CHAR) LEN(300)
            CHGVAR     VAR(&CMD) VALUE('/installedApps/curl/curl --basic +
                         --user ' || &USER |< ':' || &PASS |< ' +
                         --data status="' || &TWEET |< '" +
                         http://twitter.com/statuses/update.xml')
            QSH        CMD(&CMD)
            ENDPGM

SNDTWTMSG.cmd

            CMD        PROMPT('Send Tweet')
            PARM       KWD(USER) TYPE(*CHAR) LEN(30) CASE(*MIXED) +
                         PROMPT('User Name')
            PARM       KWD(PASS) TYPE(*CHAR) LEN(30) CASE(*MIXED) +
                         PROMPT('Password') DSPINPUT(*NO)
            PARM       KWD(TWEET) TYPE(*CHAR) LEN(140) CASE(*MIXED) +
                         PROMPT('Tweet')