PEAR Forum :: PHP Extension and Application Repository

PEAR Forum Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
HTTP_Request2 toaccess RESTful Doodle API.Can't request toke

 
Post new topic   Reply to topic    PEAR Forum Forum Index -> HTTP
View previous topic :: View next topic  
Author Message
Maddy12345



Joined: 03 Aug 2010
Posts: 3

PostPosted: Sun Aug 15, 2010 3:10 am    Post subject: HTTP_Request2 toaccess RESTful Doodle API.Can't request toke Reply with quote

Hello,

I would be very grateful if you could help me solve the following problem.

I am trying to access a web application's API on my website. The application is called Doodle, and its API -RESTful Doodle- is based on RESTful web services.

Particularly, I am trying to request a token for authentication, using the following php code:

<?php
require_once 'HTTP/Request2.php';

$oauth_consumer_key='rias4jv4mcw1k4zao3n5ueg6tp5iswvi';
$oauth_nonce=rand();
$oauth_timestamp = time();
$oauth_signature=hash_hmac('sha1', 'rias4jv4mcw1k4zao3n5ueg6tp5iswvi', 'fvrps6e4ukxvp71b79nxvpk5sw57zc63');


$request = new HTTP_Request2('http://doodle.com/api1/oauth/requesttoken');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setHeader('Content-type: text/html; charset=utf-8');
$request->setHeader('Authorization','OAuth');
$request->setHeader(array(
'realm' => '',
'oauth_consumer_key' => $oauth_consumer_key,
'oauth_signature_method' => 'HMAC-SHA1',
'oauth_timestamp' => $oauth_timestamp,
'oauth_nonce' => $oauth_nonce,
'oauth_signature' => $oauth_signature,
'oauth_version' => '1.0'
));
echo $request->send()->getBody();
?>

In theory it goes well because I get a '200 OK' reply, but I also get an error message saying 'An internal error has occurred. We are sorry for any inconvenience this may cause and keep striving to make your Doodle experience as pleasant as possible. The problem may be just temporary. Please try again later. '

What am I doing wrong?

Thank you very much,

Madeleine
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    PEAR Forum Forum Index -> HTTP All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



PEAR Forum topic RSS feed 
Powered by phpBB © 2001, 2005 phpBB Group

Provided by Ministry of Web developement