本文介绍了如何使用cURL(或任何命令行工具)使用OAuth身份验证来执行HTTP Post到Twitter?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用命令行应用程序,如一些测试帖给我的测试twitter帐户。我也希望使用OAuth身份验证。



我该如何做到这一点?假设我已经在Twitter中创建了一个应用程序,并收到了我的密钥和东西。



(另外,请确保指定要使用的密钥,命令行等)。



最后,我在未经教育的假设下,这是可能用单个命令行。

$ b好吧,你不是唯一一个希望他们可以用一个简单的 curl 来尝试一个OAuth保护的API的人。 / code>命令。您可以查看设置在您自己的机器上的HTTP代理,具有令牌和秘密的适当参数。然后任何使用该代理的请求(例如 curl 命令,例如,或者配置为使用它的Web浏览器)将自动使用所有适当的OAuth参数。



Seth的演练甚至包括了Twitter的例子,所以你应该能够按照说明逐步(假设Twitter的OAuth工作方式与9月9日)。



这不像一行简单,因为它涉及安装一些软件和至少一个额外的命令来设置代理。但是它应该至少允许一旦设置完成就允许使用 curl 进行简单的单行测试的目标。


I wish to use a command-line application, like cURL, to do some test posts to my test twitter account. I also wish to do this with OAuth authentication.

How I can do this? Assume I already have created an application, in Twitter, and received my keys and stuff.

(Also, please make sure you specify which key to use, and where, in the command line, etc.).

Finally, I'm under the (uneducated) assumption that this is possible with a single command line.

解决方案

Well, you're not the only one that's wished they could try out an OAuth-protected API with a simple curl command. You might look at oauth-proxy which sets up an HTTP proxy on your own machine with the appropriate parameters for tokens and secrets. Then any request which uses that proxy (like a curl command, for example, or even a web browser that's configured to use it) will automatically be signed with all the appropriate OAuth parameters.

Seth's walkthrough even includes the example of Twitter, so you should be able to follow the instructions step-by-step (assuming Twitter's OAuth works the same way it did in September 09).

This isn't quite as simple as a single line, since it involves installing some software and at least one additional command for setting up the proxy. But it should at least enable the goal of allowing easy, single-line tests with curl once things are set up.

这篇关于如何使用cURL(或任何命令行工具)使用OAuth身份验证来执行HTTP Post到Twitter?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 06:03