Welcome Guest, Not a member yet? Register   Sign In
Haughin’s Twitter Library - Accessing the current user's username.
#4

[eluser]luisfmgoncalves[/eluser]
Hey,

I'm not sure if I will anwser the right question, but I hope so...

For me is like, after a user login, I store his twitter id in the session. So, when I need to get the use information from twitter I just do:

Code:
$id = $this->session->userdata('id');
$user_info = $this->twitter->call('users/show', array('id' => $id));

With this, I have the JSON information in $user_info variable.

After that, to retrieve the information I just do:
Code:
if($user_info != NULL){
   $data["name"] = $user_info->name;
   $data["web"] = $user_info->url;
   $data["location"] = $user_info->location;
   $data["bio"] = $user_info->description;
}

So, in $data you will have the name, url, location and description of a user (you can retrieve more information, just look at the JSON file structure here: http://apiwiki.twitter.com/Twitter-REST-...hod:-users show)

in the end, you just need:

Code:
echo json_encode($data);
if you used JQuery to do the call

or

Code:
$this->load->view('some_view', $data);
if you want to pass the content to a view

Is this what you want?

Luis Gonçalves


Messages In This Thread
Haughin’s Twitter Library - Accessing the current user's username. - by El Forum - 05-26-2010, 04:13 AM



Theme © iAndrew 2016 - Forum software by © MyBB