- Home /
Question by
ISlandFace · May 25, 2013 at 12:19 AM ·
c#twitter
Adding a photo to "Lets Tweet in Unity" plugin
Hi everyone, been trying to figure this out but cannot get it. Im new to unity and am only learning JS, this is in C#. Can anyone help me get https://upload.twitter.com/1/statuses/update_with_media.xml to work?
private static readonly string PostTweetURL = "http://api.twitter.com/1/statuses/update.xml?status={0}";
public static IEnumerator PostTweet(string text, string consumerKey, string consumerSecret, AccessTokenResponse response, PostTweetCallback callback)
{
if (string.IsNullOrEmpty(text) || text.Length > 140)
{
Debug.Log(string.Format("PostTweet - text[{0}] is empty or too long.", text));
callback(false);
}
else
{
string url = string.Format(PostTweetURL, UrlEncode(text));
Dictionary<string, string> parameters = new Dictionary<string, string>();
parameters.Add("status", text);
// Need to fill body since Unity doesn't like an empty request body.
byte[] dummmy = new byte[1];
dummmy[0] = 0;
// HTTP header
Hashtable headers = new Hashtable();
headers["Authorization"] = GetHeaderWithAccessToken("POST", url, consumerKey, consumerSecret, response, parameters);
WWW web = new WWW(url, dummmy, headers);
yield return web;
...
Comment
Its over a year old I know but did you ever sort this out? Im attempting to do the same thing
Hi!
Did u get add a image using let´s tweet in Unity 1.1 ?
THank you in advance!
Your answer
![](https://koobas.hobune.stream/wayback/20220613102858im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Spawning portal 1 Answer
Temporarily disable gamepad button 1 Answer
Play specific animation in mechanim 1 Answer