Sub GetTwitterAccessCode(Job As HttpJob, TargetModule As Object)
Job.Initialize("Twitter", TargetModule)
Job.PostString("https://api.twitter.com/oauth2/token", "grant_type=client_credentials")
Job.GetRequest.SetHeader("User-Agent", "LCARS UI")
Job.GetRequest.SetHeader("Authorization", "Basic " & TwitterEncodedKey)
Job.GetRequest.SetHeader("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8")
Job.GetRequest.SetHeader("Accept-Encoding", "Text/plain")
End Sub
Sub EncodeTwitterConsumerKeyAndSecret(Key As String, Secret As String)
Dim STRutils As StringUtils , BYTutils As ByteConverter ,tempstr As String
TwitterClientID=Key
TwitterClientSecret=Secret
tempstr = STRutils.EncodeUrl(Key, "UTF8") & ":" & STRutils.EncodeUrl(Secret, "UTF8")
TwitterEncodedKey = STRutils.EncodeBase64( BYTutils.StringToBytes(tempstr, "UTF8"))
End Sub