Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

get twitter screen name

Tags:

php

twitter

i am new to OAuth

i want to know how to use "Twitter OAuth library from Abraham Wiliam" to get user's credential information.such as screen_name.

like image 981
shan Avatar asked Dec 27 '25 16:12

shan


1 Answers

Download this library https://github.com/abraham/twitteroauth You need just twitteroauth.php and OAuth.php files. Only twitteroauth.php to include.

Here's the Twitter sample: https://dev.twitter.com/docs/auth/oauth/single-user-with-examples#php

After declaration of getConnectionWithAccessToken() function and $connection variable with your valid app tokens just try code

$user = $connection->get("account/verify_credentials");
print $user->screen_name;

according to this Twitter REST API Reference

like image 111
optimista Avatar answered Dec 31 '25 17:12

optimista



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!