Copy link to clipboard
Copied
How are you encoding your username and password strings when accessing the Twitter API? I have tried the following with no success (401 unauthorized):
<cfhttp url="http://twitter.com/statuses/update.xml" method="POST" username="#variables.twitUN#" password="#variables.twitPW#" charset="UTF-8" timeout="30">
<cfhttpparam type="HEADER" name="Authorization" value="Basic #ToBase64(variables.twitUN & ':' & variables.twitPW)#">
<cfhttpparam type="FORMFIELD" name="status" value="#CharsetEncode(CharsetDecode(variables.twitStatus, 'utf-8'), 'utf-8')#">
</cfhttp>
Any insight would be greatly appreciated, thank you.
Copy link to clipboard
Copied
You could try specifying a USERAGENT in yout <cfhttp> call. I've found some services don't like HTTP requests that don't seem to originate from a browser. I've never used Twitter, so I don't know if it's the case here, but it's easy enough to give it a go and find out.
--
Adam