1 doubt how will i get $_SESSION['oauth_token'], $_SESSION['oauth_token_secret'] in first function?
–
HarishFeb 2 '11 at 8:27

Those are first set when getting the temporary request token in your second page.
–
ArvinFeb 2 '11 at 8:31

One thing I noticed was that you didn't specify the callback URL when calling $connection->getRequestToken() on your second page. Is the callback URL already set in your application settings? I assume that was set to your first page.
–
ArvinFeb 2 '11 at 8:36