I'm following this tutorial to access the del.icio.us api, but this is my first time using cURL or OAuth so hitting a few snags.
I'm using the following code
$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);
according to the tutorial, this should return something like the following
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
but when I try to echo $cont开发者_运维问答ents, it returns blank. Any ideas?
Ok turns out my main mistake was to use '+' instead of '.' to add different strings together. Also, the secret seems to require %26 after it, not sure why though.
精彩评论