cakephp httpsocket to make auth_info request

27 views
Skip to first unread message

Chris974

unread,
Oct 8, 2009, 7:35:49 AM10/8/09
to RPX Developers
Hi everybody,

I would like to use the library httpsocket delivered with the cakephp
framework to call the RPX API's method auth_info, but I have no
answer.
Here is the code I use:
-----------------------------------------------------------------------------------
App::import('Core', 'HttpSocket');

$HttpSocket = new HttpSocket();

$result = $HttpSocket->get(
'https://rpxnow.com/api/v2/auth_info',
array(
'apiKey' => 'mykey',
'token' => 'http://localhost/'
)
);
-----------------------------------------------------------------------------------

If anybody has a working, he is more than welcome.

Thanks in advance,

Chris974

Mario

unread,
Oct 24, 2009, 7:41:24 AM10/24/09
to RPX Developers
Hi Chris,

I am just beginning to approach RPX from a CakePHP perspective, so I
am very interested in sharing experiences.

I was wondering, shouldn't this be a $HttpSocket->post request instead
of get?

From RPX website:
"Make the auth_info API call
HTTP POST to https://rpxnow.com/api/v2/auth_info with the following
required parameters:
apiKey ...
token Use the token sent to your token_url
RPX will respond with a JSON formatted response including the
identifier of the user."

Best,

Mario

Mario

unread,
Oct 25, 2009, 2:24:44 PM10/25/09
to RPX Developers
I confirm post is needed, plus (see the code below):

* value for 'token' key must be the actual token RPX is POSTing to
your token_url
* in the first line I applied 2 functions (working only with PHP5) to
transform the JSON data into an array, if needed

$result = Set::reverse(json_decode( // JSON to object to array
$HttpSocket->post(
'https://rpxnow.com/api/v2/auth_info',
array(
'apiKey' => $apiKey,
'token' => $this->params['form']['token'], // POSTed to
token_url after a successful auth
)
)
));

Best,

Mario


On 24 Ott, 12:41, Mario <mario.calli...@gmail.com> wrote:
> Hi Chris,
>
> I am just beginning to approach RPX from a CakePHP perspective, so I
> am very interested in sharing experiences.
>
> I was wondering, shouldn't this be a $HttpSocket->post request instead
> of get?
>
> From RPX website:
> "Make the auth_info API call
> HTTP POST tohttps://rpxnow.com/api/v2/auth_infowith the following
Reply all
Reply to author
Forward
0 new messages