0

Oauth::fetch error

I'm testing oauth for grabbing a users yahoo contacts using the examples here, http://svn.php.net/viewvc/pecl/oauth/trunk/examples/ . I've done all the handshaking but when finally trying to make the api call to grab the contacts, I get this "HTTP/1.0 411 Length Required" error. There is very limited info out there on this. Any suggestions? Thanks.

CODE
Warning: OAuth::fetch(http://query.yahooapis.com/v1/yql?q=select%20%2A%20from%20social.profile%20where%20guid%3Dme&format=xml) [oauth.fetch]: failed to open stream: HTTP request failed! HTTP/1.0 411 Length Required in /home/www/contacts2/examples/yahoo/exec_yql.php on line 18
Exception caught! Response:



CODE
<?php
require("config.inc.php");
try {
$o = new OAuth(OAUTH_CONSUMER_KEY,OAUTH_CONSUMER_SECRET,OAUTH_SIG_METHOD_HMACSHA1,OAUTH_AUT
H_TYPE_AUTHORIZATI ON);
$access_token_info = unserialize(file_get_contents(OAUTH_TMP_DIR . "/access_token_resp"));

$o->setToken($access_token_info["oauth_token"],$access_token_info["oauth_token_secret"]);
$query = rawurlencode("select * from social.profile where guid=me");
$o->fetch("http://query.yahooapis.com/v1/yql?q=$query&format=xml");

$response_info = $o->getLastResponseInfo();
header("Content-Type: {$response_info["content_type"]}");
echo $o->getLastResponse();
} catch(OAuthException $E) {
echo "Exception caught!\n";
echo "Response: ". $E->lastResponse . "\n";
}
?>

by
0 Replies

Recent Posts

in General Discussion at YDN