简体   繁体   English

发送Twitter Tweet和Facebook状态的最简单方法

[英]Simplest Method to Send Twitter Tweet and Facebook Status

With Twitter's new OAuth interface, their API is now many times more complex than what it was. 借助Twitter的新OAuth接口,其API现在比以前复杂了很多倍。 And I haven't even looked at Facebook's API yet. 而且我什至都没有看过Facebook的API。

What I'm wondering if there is a method that employs some higher-level, existing code or interfaces to make this a simpler task. 我想知道是否有一种方法可以使用一些更高级的现有代码或接口来简化此任务。

All I want to be able to do is initiate a Twitter tweet or Facebook share on the user's behalf and be able to control the initial text of those messages, from an ASP.NET application. 我要做的就是代表用户发起Twitter推文或Facebook共享,并能够从ASP.NET应用程序控制这些消息的初始文本。

I found some similar questions on SO, but they had no answers. 我在SO上找到了一些类似的问题,但没有答案。

EDIT: I know there are things like AddThis and ShareThis, but I need something that will give me control over the default message. 编辑:我知道有类似AddThis和ShareThis的东西,但是我需要一些可以让我控制默认消息的东西。 It must contain a link with a code that is specific to the current user. 它必须包含一个链接,该链接带有特定于当前用户的代码。

Twitter Integration... Twitter集成...

For making Tweets from an ASP.NET application on users' behalf, check out Twitterizer . 要代表用户从ASP.NET应用程序制作推文,请查看Twitterizer It's a free, open-source project for integrating with Twitter from .NET applications. 这是一个免费的开源项目,用于与.NET应用程序中的Twitter集成。

I agree that using OAuth can be a bit daunting, but the Twitterizer API wraps up most of the complexity. 我同意使用OAuth可能会有些令人生畏,但是Twitterizer API弥补了大多数复杂性。 I've written an article on using Twitterizer in an ASP.NET application that you may be interested in: Integrating Twitter Into An ASP.NET Website Using OAuth . 我写了一篇您可能对在ASP.NET应用程序中使用Twitterizer感兴趣的文章: 使用OAuth将Twitter集成到ASP.NET网站中 After reading the article, download the code sample at the end, which is a working demo showing how to use Twitterizer to post a tweet from an ASP.NET website. 阅读本文之后,请在最后下载代码示例,这是一个有效的演示,演示如何使用Twitterizer从ASP.NET网站发布推文。

Facebook Integration... Facebook整合...

For integrating with Facebook, chcek out the Facebook Developer Toolkit . 要与Facebook集成,请退出Facebook Developer Toolkit Like Twitterizer, it's an open-source, free API and should get you going in the right direction. 像Twitterizer一样,它是一个开放源代码,免费的API,应该使您朝正确的方向前进。

Happy Programming! 编程愉快!

This is probably what you're after for twitter: https://twitter.com/about/resources/buttons#tweet 这可能是您追求Twitter的目的: https : //twitter.com/about/resources/buttons#tweet

Let's you configure a button (or URL to redirect to) that starts the user off with some default text. 让我们配置一个按钮(或重定向到的URL),该按钮使用一些默认文本启动用户。 The user can change the text before they post. 用户可以在发布前更改文本。

Don't know about facebook. 不知道facebook。

Twitter Integration: Twitter集成:

Check this code and link/article simple and easy : 检查此代码,链接/文章简单易行:

protected void btnTweet_Click(object sender, EventArgs e)
{
 string oauthAccessToken = Session["twtoken"].ToString();
 string oauthAccessTokenSecret = Session["twsecret"].ToString();

 OAuthHelper oauthhelper = new OAuthHelper();
 oauthhelper.TweetOnBehalfOf(oauthAccessToken, oauthAccessTokenSecret, txtTweet.Text);

 if (string.IsNullOrEmpty(oauthhelper.oauth_error))
      Response.Write("Twit Posted Successfully");
 else
      Response.Write(oauthhelper.oauth_error);
}

Read more how to get access token and secret key and download OAuthHelper and OAuthUtility Class below is the link - 详细了解如何获取访问令牌和密钥并下载OAuthHelper和OAuthUtility类,下面是链接-

How to post tweet on behalf of an user from asp.net using oauth authentication 如何使用oauth身份验证代表来自asp.net的用户发布推文

Login with twitter using oauth authentication in asp.net and get access token, screen name and userid 在asp.net中使用oauth身份验证使用Twitter登录并获取访问令牌,屏幕名称和用户ID

After looking around for a while, I found sharethis.com. 环顾了一会后,我发现了sharethis.com。 They have various share buttons you can add to your site that send Twitter tweets, Facebook shares, etc. 它们具有各种共享按钮,您可以将其添加到您的站点,以发送Twitter推文,Facebook共享等。

It looks like it also supports options to control the URL, so I could modify this to include whatever URL I need. 看起来它还支持控制URL的选项,因此我可以对其进行修改以包括所需的任何URL。

I haven't yet figured out if I can control the default message text. 我还不确定是否可以控制默认消息文本。 I'm looking into that. 我正在调查。

But it seems like this is probably the simplest way to accomplish what I want. 但这似乎是实现我想要的最简单的方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Twitter转推的推文计数 - Twitter Retweet count of a Tweet 我如何将带有数据的推文消息从我的网站发送到Twitter帐户 - how do i send tweet message with data from my site to twitter account Twitter推特事件绑定/重新绑定 - Twitter tweet event binding/rebinding Twitter API + OAuth:无法发送状态更新,收到 401 - Twitter API + OAuth: Can't send status updates, getting 401 试图在用户控件中将Facebook像,发送,twitter和google plus一样传递为内部html。 - Trying to pass facebook like, send, twitter and google plus as inner html in a user control. 如何通过 twitter api 按 screenName 检索推文,以便我可以获得推文创建日期、推文和推文媒体? - How to retrieve tweets by screenName via the twitter api so that I can get tweet created date, tweet and tweet media? 验证 Twitter 用户并在他的帐户 C# 上发布推文 - Verify Twitter User and Post tweet on his on account C# 如何从我的Twitter获得第一条推文并将其显示在我的网页上? - how to get the first tweet from my twitter and display it on my webpage? Twitter喜欢ASP.Net中的新推文计数通知 - Twitter like new tweet count notification in ASP.Net Twitter API删除字符以添加到原始推文的链接 - Twitter API removes characters to add link to original tweet
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM