【问题标题】:how to get details of current user in twitter如何在推特中获取当前用户的详细信息
【发布时间】:2012-03-02 05:07:10
【问题描述】:

我正在开发一个 PHP 应用程序,我想为它获取有关使用 OAuth 的当前 twitter 用户的一些信息。

类似的信息

  1. 屏幕名称
  2. 出生日期
  3. 电子邮件 ID 4 .时区等

这些事情我已经完成了

  1. 创建了一个推特应用。
  2. 通过使用回调的登录 url 获得 oauth_token 和 oauth_verifier。

我需要一个 API 请求语法,例如

$user = $connection->get('account/verify_credentials');

上面会给出详细信息,在Facebook中基本相当于

$this->facebook->api('/me');

谢谢。

【问题讨论】:

  • 你使用了什么 OAuth 库?
  • Twitter API 文档显示了您可以在dev.twitter.com/docs/api/1/get/users/show 上检索到的有关用户的信息。您可以从列表中获得 #1 和 #4。
  • 我用过 TwitterOAuth v0.2.0-beta2。
  • @jcmeloni 谢谢。这包含我想要的所有信息。

标签: php twitter oauth


【解决方案1】:

电子邮件地址不可用。您可以使用此获取更多数据

https://dev.twitter.com/docs/api/1/get/users/show

通过此查询,您将获得所有这些数据:

 {
  "profile_sidebar_fill_color": "e0ff92",
  "name": "Twitter API",
  "profile_sidebar_border_color": "87bc44",
  "profile_background_tile": false,
  "created_at": "Wed May 23 06:01:13 +0000 2007",
  "profile_image_url": "http://a3.twimg.com/profile_images/689684365/api_normal.png",
  "location": "San Francisco, CA",
  "follow_request_sent": false,
  "id_str": "6253282",
  "profile_link_color": "0000ff",
  "is_translator": false,
  "contributors_enabled": true,
  "url": "http://dev.twitter.com",
  "favourites_count": 15,
  "utc_offset": -28800,
  "id": 6253282,
  "profile_use_background_image": true,
  "listed_count": 6868,
  "profile_text_color": "000000",
  "protected": false,
  ...

以及有关 Twitter 论坛中电子邮件的更多信息: https://dev.twitter.com/discussions/1737

如果用户在您的数据库中没有电子邮件,我会在 Twitter 登录后将用户重定向到小表单。

【讨论】:

  • 。非常感谢。我需要电子邮件地址,因为我将其用于登录表单。我们能找到什么方法吗?
  • 如果用户在您的数据库中没有电子邮件,我会在 Twitter 登录后将用户重定向到小表单。
  • 当然我也会这样做。要求用户填写表格。手动感谢
猜你喜欢
  • 2021-06-11
  • 1970-01-01
  • 2020-05-06
  • 1970-01-01
  • 2010-10-12
  • 1970-01-01
  • 2017-10-06
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多