Closed GoogleCodeExporter closed 8 years ago
Yeah, I found this problem too. The code above is missing a slash "/" in the
URL and
has an extra echo statement. I also removed the (int) before $id, so that you
can
send $t->showUser('username'). Here's the version that I have working:
function showUser( $id, $email = false, $user_id = false, $screen_name=false )
{
if( !in_array( $this->type, array( 'xml','json' ) ) )
return false;
if( $user_id ) :
$qs = '.' . $this->type . '?user_id=' . (int) $user_id;
elseif ( $screen_name ) :
$qs = '.' . $this->type . '?screen_name=' . (string) $screen_name;
elseif ( $email ) :
$qs = '.' . $this->type . '?email=' . (string) $email;
else :
$qs = $id . '.' . $this->type;
endif;
$request = 'http://twitter.com/users/show/' . $qs;
return $this->objectify( $this->process($request) );
}
Original comment by JeffOr...@gmail.com
on 18 Apr 2009 at 8:59
Yup, you're absolutely right about the extra echo. However, I think we're both
wrong
with the slash...since the correct formats are:
http://twitter.com/users/show.json?user_id=101010
http://twitter.com/users/show.json?screen_name=john_doe
http://twitter.com/users/show.json?screen_name=johndoe@example.com
http://twitter.com/users/show/101010.json
http://twitter.com/users/show/john_doe.json
Here's an alternate:
function showUser( $id, $email = false, $user_id = false, $screen_name=false )
{
if( !in_array( $this->type, array( 'xml','json' ) ) )
return false;
if( $user_id ) :
$qs = '.' . $this->type . '?user_id=' . (int) $user_id;
elseif ( $screen_name ) :
$qs = '.' . $this->type . '?screen_name=' . (string) $screen_name;
elseif ( $email ) :
$qs = '.' . $this->type . '?email=' . (string) $email;
else :
$qs = '/' . $id . '.' . $this->type;
endif;
$request = 'http://twitter.com/users/show' . $qs;
return $this->objectify( $this->process($request) );
}
Original comment by garyl...@gmail.com
on 18 Apr 2009 at 10:25
Please provide actual patches/diffs in the future. It will help me get code
into SVN quicker without having to
ascertain the actual changes. r96 fixes in /branches/1.1 and r95 fixes in
trunk. Thanks
Original comment by emmenset...@gmail.com
on 16 Jun 2009 at 5:55
Original comment by emmenset...@gmail.com
on 16 Jun 2009 at 5:55
Original issue reported on code.google.com by
garyl...@gmail.com
on 10 Apr 2009 at 3:10