I have installed FOSTwitterBundle and set up key on Twitter.
I create this Action:
public function twitterFirstAction(Request $request)
{
$twitter = $this->get('fos_twitter.service');
$authURL = $twitter->getLoginUrl($request);
$response = new RedirectResponse($authURL);
return $response;
}
It redirects to twitter and redirected back to twitterSecondAction()
public function twitterSecondAction(Request $request)
{
$twitter = $this->get('fos_twitter.service');
// now what
}
I checked the session, everything is fine. But now I get confuse how to make an API call. For example, list user’s followers.
FOSTwitterBundle has
fos_twitter.apiservice which is TwitterOAuth class which allows you to do get, post and delete requests.So your second action can look like this:
Please see twitter API documentation for possible actions.