oAuth 在 PHP 中发出 2 条腿的请求 [英] oAuth in PHP to make 2 legged request
问题描述
我目前在尝试使用 PHP 的 2 条 oAuth 请求向服务的 api 发出请求.
I am currently stuck trying to make requests to a service's api using a 2 legged oAuth request using PHP.
我正在使用此处找到的 PHP 库:http://code.google.com/p/oauth-php/ 并且似乎绝对没有在线任何地方使用此库进行 2 条腿请求的文档.
I am using the PHP library found here: http://code.google.com/p/oauth-php/ and there seems to be absolutely no documentation anywhere online for using this library for a 2 legged request.
所以目前从服务中我有以下详细信息:
So currently from the service I have the following details:
- $consumer_key - 必须是空字符串
- $consumer_secret - 必须是空字符串
- $access_token - 我的登录名
- $access_token_secret - 您生成的应用程序令牌
- $consumer_key - needs to be an empty string
- $consumer_secret - needs to be an empty string
- $access_token - my login name
- $access_token_secret - your generated application token
我希望能够向以下对象提出请求:
And I want to be able to make a request to:
http://foo.com/api/test/whoami
测试身份验证是否正常工作,以便我可以使用 api 的其余部分.
To test that the authentication is working correctly so I can use the rest of the api.
有人知道如何使用该 php 库来实现这一目标吗?或者有没有更好的方法来进行这样的简单 2 腿通话?
Anybody got any pointers on how to use that php library to achieve this? or are there better methods for a simple 2 legged call like this?
帮助!?:)
推荐答案
这个小例子可能会有所帮助 http://developer.yahoo.com/blogs/ydn/posts/2010/04/a_twolegged_oauth_serverclient_example/
This little example might help http://developer.yahoo.com/blogs/ydn/posts/2010/04/a_twolegged_oauth_serverclient_example/
这篇关于oAuth 在 PHP 中发出 2 条腿的请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!