tags:

views:

23

answers:

2

Hi,

I am using cakephp. I am trying to use httpsocket to get information.

<?php 

  App::import('Core', 'HttpSocket'); 
  $HttpSocket = new HttpSocket();
  $results =$HttpSocket->get('https://graph.facebook.com/XXXXXXXXXXX/', 'access_token=111978XXXXXXXXXXX|2.1lD7XrS1nXXXXXXXXXXX__.3600.1279976400-XXXXXXXXXXXXX|9vJZuRDvlzLhFfXXXXXXXXXXX.');

  print_r($results);

?>

I am not able to see the results. The output type is json. The output looks like this

{
   "id": "XXXXXXXXX",
   "name": "XXXX XXXXXX",
   "first_name": "XXXX",
   "last_name": "XXXXXX",
   "link": "http://www.facebook.com/XXXXXXXXXXX",
   "gender": "male",
   "locale": "en_GB",
   "updated_time": "2010-05-18T19:46:52+0000"
}

How could i get retrieve the json output?

I appreciate any help.

Thanks.

A: 

Do you know about json_decode?

$results = json_decode($results, true);

Or is the problem that $results is false or null? What does debug($HttpSocket->results) show?

deceze
I get null, but when i plug it in address bar, I can see the user info.
Nick
@Nick So what does `debug($HttpSocket->result)` show you?
deceze
A: 

Have you tried it using plan HTTP instead of HTTPS?

I notice that in IE if I try to access:

https://graph.facebook.com/19292868552

It gives me an error. But if I try just:

http://graph.facebook.com/19292868552

Then it returns the json information.

Jack B Nimble