Search This Site

Custom Search

Wednesday, December 8, 2010

[bloggerDev] Re: can't get user secured data using oauth

Brett,

I'm using the latter, http://www.blogger.com/feeds/.

here's the fragment code :

$issued=gmdate("Y-m-d\TH:i:s\Z", time());
$post_endpoint = 'https://www.blogger.com/feeds/' .urlencode($this-
>_blogId) . '/posts/default';
$content = "<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
\r\n"
. "<entry>\r\n"
. "<title mode='escaped' type='text'>".$title."</title>\r\n"
. "<issued>".$issued."</issued>\r\n"
. "<generator url='http://mysite.com'> MySite</generator>\r\n"
. "<content type='application/xhtml+xml'>\r\n"
. "<div xmlns='http://www.w3.org/1999/xhtml'>".$body."</div>\r
\n"
. "</content>\r\n"
. "</entry>\r\n";
try {
$oauth = new OAuth(
$this->consumerKey ,
$this->consumerSecretKey ,
OAUTH_SIG_METHOD_HMACSHA1 ,
OAUTH_AUTH_TYPE_URI
);

$oauth->setToken($this->accessToken , $this->accessTokenSecret);
$oauth->fetch($post_endpoint, $content, OAUTH_HTTP_METHOD_POST,
array("Content-Type" => "application/atom+xml"));

} catch(OAuthException $e) {
return "Response: ". $e->lastResponse;
}

return true;
}

I dunno what is wrong with this code.

Thanks for your reply

--
You received this message because you are subscribed to the Google Groups "Blogger Developer Group" group.
To post to this group, send email to bloggerdev@googlegroups.com.
To unsubscribe from this group, send email to bloggerdev+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/bloggerdev?hl=en.

No comments:

Post a Comment