$connection = new TwitterOAuth($this->container->getParameter('twitter_consumer_key'),$this->container->getParameter('twitter_consumer_secret'),$token,$token_secret);
$post = $connection->post('statuses/update',array('status' => $post->getContent()));
this is my php code. I am using Abraham Williams PHP library.
and I use the below code to get the authorize url. twitter redirect to me with token and token secret after asking the user whether he allows that my app post to tweeter as well as some other permissions.
$url = $connection->getAuthorizeURL($token);