2012-02-09 645 views
1

我正在研究一個PHP應用程序,我希望獲取有關使用OAuth的當前twitter用戶的一些信息。如何在twitter中獲取當前用戶的詳細信息

信息,如

  1. 網名
  2. 出生日期
  3. 電子郵件ID 4。時間區等

我已經完成了

    這些東西
  1. 創建一個twitter應用程序。
  2. 通過使用回調的登錄URL獲取oauth_token和oauth_verifier。

我需要像

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

API請求語法,這將給上述細節,基本上相當於在Facebook上

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

感謝。

+0

你使用了什麼OAuth庫? – Mob 2012-02-09 17:33:50

+4

Twitter API文檔顯示了您可以在https://dev.twitter.com/docs/api/1/get/users/show找到有關用戶的內容。您可以從列表中獲得#1和#4。 – jcmeloni 2012-02-09 17:36:28

+0

我已經使用TwitterOAuth v0.2.0-beta2。 – 2012-02-09 17:40:30

回答

2

電子郵件地址不可用。你可以得到更多的DATAS本

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

與這個查詢,你會得到這一切DATAS:在Twitter上論壇上關於電子郵件

{ 
    "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, 
    ... 

和更多信息: https://dev.twitter.com/discussions/1737

如果用戶在你的數據庫中沒有電子郵件,我會做的就是在Twitter登錄後將用戶重定向到小型表單。

+0

。非常感謝。我使用電子郵件地址作爲登錄表單使用。任何方式我們都可以找到它? – 2012-02-10 02:33:08

+0

如果用戶在你的數據庫中沒有電子郵件,我會做的就是在Twitter登錄後將用戶重定向到小型表單。 – 2012-02-10 10:05:30

+0

當然我也會這樣做,需要用戶填寫表格。手動感謝 – 2012-02-10 13:35:43

相關問題