【问题标题】:Using cURL/OAuth to access del.icio.us api使用 cURL/OAuth 访问 del.icio.us api
【发布时间】:2010-07-31 00:24:38
【问题描述】:

我正在关注 this tutorial 以访问 del.icio.us api,但这是我第一次使用 cURL 或 OAuth,因此遇到了一些障碍。

我正在使用以下代码

    $ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "https://api.login.yahoo.com/oauth/v2/get_request_token?oauth_nonce=123456789&oauth_timestamp="+$timestamp+"&oauth_consumer_key="+$consumerKey+"&oauth_signature_method=plaintext&oauth_signature="+$secret+"&oauth_version=1.0&xoauth_lang_pref=en-us&oauth_callback=http://www.chris-armstrong.com/paperclip");

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);

$contents = curl_exec ($ch);

curl_close ($ch);

根据教程,这应该返回如下内容

组oauth_token%3Drpfbncv%26oauth_token_secret%3D5f2e792b36c40edaf7bdd8fb10b6edd1fde87a52%26oauth_expires_in%3D3600%26xoauth_request_auth_url%3Dhttps%253A%252F%252Fapi.login.yahoo.com%252Foauth%252Fv2%252Frequest_auth%253Foauth_token%253Drpfbncv%26oauth_callback_confirmed%3Dtrue P>

但是当我尝试回显 $contents 时,它返回空白。有什么想法吗?

【问题讨论】:

    标签: php api curl oauth delicious-api


    【解决方案1】:

    好吧,原来我的主要错误是使用“+”而不是“。”将不同的字符串添加在一起。此外,秘密似乎需要 %26 之后,但不知道为什么。

    【讨论】:

      猜你喜欢
      • 2014-10-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-06-07
      • 2019-10-24
      • 2015-11-11
      • 1970-01-01
      相关资源
      最近更新 更多