Click here to Skip to main content
16,017,788 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello when i run the program i get an error in response.Content that says bad authentication data error code 215
does anyone has an idea on how to solve the problem??
ill gladly appreciate some help!
thanks



C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using TweetSharp;
using Hammock;

namespace TweetNow
{
class TweetManager
{

static public TwitterService initiate()
{
String _consumerKey = "*********";
String _consumerSecret = "*********";

String _accessToken = "***********************************";
String _accessTokenSecret = "********************************";
// Pass your credentials to the service
TwitterService service = new TwitterService(_consumerKey, _consumerSecret);

// Retrieve an OAuth Request Token
service.AuthenticateWith(_accessToken, _accessTokenSecret);

return service;


}



 
public static void sendTweet(String msg,String picname,TwitterService serv) {


RestRequest request = serv.PrepareEchoRequest();
request.Path = "uploadAndPost.xml";
request.AddFile("media", "smile", "Images/"+picname, "image/jpeg");


 
//request.AddField("key", "*******************************"); 
request.AddField("key", "*********************************"); 
request.AddField("message", "Emote with a Pic!");


RestClient client = new RestClient { Authority = "http://api.twitpic.com/", VersionPath = "2" };
RestResponse response = client.Request(request);
Console.WriteLine(response.Content);

String str = response.Content;
int first = str.IndexOf("");
int last = str.LastIndexOf("");
string str2 = str.Substring(first + 5, last - first - 5);

serv.SendTweet(msg+" "+str2+" .");
}
}
}
Posted
Updated 9-Jul-13 0:15am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900