------------------------------------
### =C2=A0Set Varia=bles =C2=A0###
[/!][text]con_key=3D[url]xxxxxxxxx[=/url][/text][!] App Consumer Key
[/!][text]con_secret=3D[url]xxxx=xxxxx[/url][/text][!] App Consumer Secret
[/!][text]screen_name=3D[url]target-handle[/url][/text]=[!] Twitter account we are targeting
[/!][text]count=3D6[/text][!=] Number of Tweets to return
[/!][text]include_rts=3D1[/text][!] =Set to 1 if retweets are to be included
[/!][text]CRLF=3D[unurl]%0D%0A[/unurl][/text][!] CRLF V=ariable
[/!][text]debug=3DF[/text][!] Show debug fields
=------------------------------------
### =C2=A0Get OAuth= Credentials =C2=A0###
[/!][text]content=3Dgrant_t=ype=3Dclient_credentials[/text][!]
[/!][text]jsonR=esponse=3D[TCPConnect host=3D
api.twitter=.com&port=3D443&ssl=3DT][!]
[/!][tcpsend skipheader=3DF]POST /oauth2/token HTTP/1.1[CRLF][!]
=
[/!]User-Agent: Your-Twitter-App-Name[CRLF][!]
[/!]=Authorization: Basic [encrypt method=3DBase64][con_key]:[con_secret][/encry=pt][CRLF][!]
[/!]Content-type: application/x-www-form-urlencoded;charset=3DUTF-8[CR=LF][!]
[/!]Content-Length: [countchars][content][/countchars][CRL=F][CRLF][!]
Accept-Encoding: gzip[crlf][crlf][/!][!]
[/!][content][CRLF][!]
[/!][/tcpsend][/tcpconnect][/text][!]
## debug info ##
[/!][showif [debug]=3DT]<=;h3>OAuth Json Response</h3>
<pre>[jsonResponse]&l=t;/pre>[/showif][!]
------------------------------------
### =C2=A0Set up Json Parse Convert table= =C2=A0###
[/!][table name=3DjsonParseConvert&fields=3Dfrom,to=]
"
=
:=3D
[/ta=ble][!]
------------------------------------
### =C2=A0Parse Json =C2=A0###
=
[/!][listwords words=3D[url][jsonResponse][/url]&delimiters=3D{},][text=][convertwords table=3DjsonParseConvert][word][/convertwords][/text][/listw=ords][!]
## debug info ##
[/!][showif [debug]=3DT]<h3>OAuth Access Token</h3>
<pre>[access_token]</pre>[/showif][!]
=
----=--------------------------------
### =C2=A0Connect and pull down tweets - write to json f=ile =C2=A0###
[/!][writefile file=3Dclient.json][!]
[/!][TCPSend skiph=eader=3DT]GET /1.1/statuses/user_timeline.json?screen_name=3D[screen_name]&=amp;count=3D[count]&include_rts=3D[include_rts] HTTP/1.1[CRLF][!]
=
[/!]User-Agent: Di=gRevs Twitter App v1[CRLF][!]
[/!]Authorization: Bearer [access_token][CRLF][CRLF][/TCPS=end][!]
[/!][/TCPConnect][!=]
[/!][/writefile][!]
------------=------------------------
### =C2=A0Close res=trict to 15 mins showif =C2=A0###
=div>
--047d7bdca4e611907104e2ca0846--
Associated Messages, from the most recent to the oldest:
--047d7bdca4e611907104e2ca0846Content-Type: text/plain; charset=UTF-8David,Hi - here you go. It's very slow (maybe Twitter are rate limiting) so Iuse a trigger it to periodically write a json file to disk. You'll needto set up a Twitter App on their developer site and get a key/secret.- Tom
[!][/!]
[!]------------------------------------ ### Restrict trigger to 15 minute intervals ###[/!][showif [time %M]\15]
[!]------------------------------------ ### Set Variables ###[/!]
[text]con_key=
[url]xxxxxxxxx[/url][/text]
[!] App Consumer Key[/!]
[text]con_secret=
[url]xxxxxxxxx[/url][/text]
[!] App Consumer Secret[/!]
[text]screen_name=
[url]target-handle[/url][/text]
[!] Twitter account weare targeting[/!]
[text]count=6[/text]
[!] Number of Tweets to return[/!]
[text]include_rts=1[/text]
[!] Set to 1 if retweets are to be included[/!]
[text]CRLF=
[unurl]%0D%0A[/unurl][/text]
[!] CRLF Variable[/!]
[text]debug=F[/text]
[!] Show debug fields------------------------------------ ### Get OAuth Credentials ###[/!]
[text]content=grant_type=client_credentials[/text]
[!][/!]
[text]jsonResponse=[TCPConnect host=api.twitter.com&port=443&ssl=T]
[!][/!][tcpsend skipheader=F]POST /oauth2/token HTTP/1.1[CRLF]
[!][/!]Host: api.twitter.com[CRLF]
[!][/!]User-Agent: Your-Twitter-App-Name[CRLF]
[!][/!]Authorization: Basic [encryptmethod=Base64][con_key]:[con_secret][/encrypt][CRLF]
[!][/!]Content-type: application/x-www-form-urlencoded;charset=UTF-8[CRLF]
[!][/!]Content-Length:
[countchars][content][/countchars][CRLF][CRLF]
[!]Accept-Encoding: gzip[crlf][crlf][/!]
[!][/!][content][CRLF]
[!][/!][/tcpsend][/tcpconnect][/text]
[!]## debug info ##[/!][showif [debug]=T]
OAuth Json Response
[jsonResponse]
[/showif]
[!]------------------------------------### Set up Json Parse Convert table ###[/!][table name=jsonParseConvert&fields=from,to]": =[/table]
[!]------------------------------------### Parse Json ###[/!][listwordswords=
[url][jsonResponse][/url]&delimiters={},]
[text][convertwordstable=jsonParseConvert][word][/convertwords][/text][/listwords]
[!]## debug info ##[/!][showif [debug]=T]
OAuth Access Token
[access_token]
[/showif]
[!]------------------------------------### Connect and pull down tweets - write to json file ###[/!][writefile file=client.json]
[!][/!][TCPConnect host=api.twitter.com&port=443&ssl=T]
[!] [/!][TCPSend skipheader=T]GET/1.1/statuses/user_timeline.json?screen_name=[screen_name]&count=[count]&include_rts=[include_rts]HTTP/1.1[CRLF]
[!][/!]Host: api.twitter.com[CRLF]
[!] [/!]User-Agent: DigRevs Twitter App v1[CRLF]
[!][/!]Authorization: Bearer [access_token][CRLF][CRLF][/TCPSend]
[!] [/!][/TCPConnect]
[!][/!][/writefile]
[!]------------------------------------ ### Close restrict to 15 mins showif ###[/!][/showif]Complete--047d7bdca4e611907104e2ca0846Content-Type: text/html; charset=UTF-8Content-Transfer-Encoding: quoted-printable
David,
Hi - here you go. =C2=A0 It'=s very slow (maybe Twitter are rate limiting) so I use a trigger it to peri=odically write a json file to disk. =C2=A0 You'll need to set up a Twit=ter App on their developer site and get a key/secret.
- Tom
[!]<!-- HAS_WEBDNA_TAGS -->
------------------------------------
### =C2=A0Restrict =trigger to 15 minute intervals =C2=A0###
[/!][show=if [time %M]\15]
[!]