Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8367647
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T13:12:45+00:00 2026-06-09T13:12:45+00:00

I am trying to develop a twitter application using php and tmhOAuth I am

  • 0

I am trying to develop a twitter application using php and tmhOAuth

I am using this code to get access token . This code is working in my testing server but not in the production server. php configuration of two server is almost same.

if(isset($_REQUEST['oauth_verifier'])) {
  $tmhOAuth->config['user_token']  = $_SESSION['oauth']['oauth_token'];
  $tmhOAuth->config['user_secret'] = $_SESSION['oauth']['oauth_token_secret'];

  $code = $tmhOAuth->request('POST', $tmhOAuth->url('oauth/access_token', ''), array(
    'oauth_verifier' => $_REQUEST['oauth_verifier']
  ));

  if ($code == 200) {
    $_SESSION['access_token'] = $tmhOAuth->extract_params($tmhOAuth->response['response']);
    unset($_SESSION['oauth']);
    header("Location: {$here}");
  } else {
    outputError($tmhOAuth);
  }

}

I am getting empty response from twitter [response] => .

At least I should get an error message. Please can anybody tell me what’s wrong?

tmhOAuth Object
(
    [params] => Array
        (
        )

    [headers] => Array
        (
            [Authorization] => OAuth oauth_consumer_key="htxmSKEwkd5jPB6z1bQI6Q", oauth_nonce="adb19fb2bc5f76060b63bcbb1b3e2b94", oauth_signature="E5Vb62A00L8Nj8uyt9MRKdFk6ck%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1329438683", oauth_token="g3ekXAg9SwoYIge2l1E6JGwIQ02QYiha8uz5TMVA", oauth_verifier="vOrM6QWwGRpTEWgE2Kk2Y87DL1mlx324r4wh2SsUo", oauth_version="1.0"
            [Content-Type] => 
            [Content-Length] => 
            [Expect] => 
        )

    [auto_fixed_time] => 
    [buffer] => 
    [config] => Array
        (
            [user_agent] => tmhOAuth 0.61+SSL - //github.com/themattharris/tmhOAuth
            [use_ssl] => 1
            [host] => api.twitter.com
            [consumer_key] => htxmSKEwkd5jPB6z1bQI6Q
            [consumer_secret] => fmNsDdu809uAARz0EslIL5Tj9m3XxLuaTVg6RSVnAQ
            [user_token] => g3ekXAg9SwoYIge2l1E6JGwIQ02QYiha8uz5TMVA
            [user_secret] => 4K8chxSWwwQ5nk1HSQrrbNW23FIGWiNLMycoqqxUV0
            [force_nonce] => 
            [nonce] => adb19fb2bc5f76060b63bcbb1b3e2b94
            [force_timestamp] => 
            [timestamp] => 1329438683
            [oauth_version] => 1.0
            [oauth_signature_method] => HMAC-SHA1
            [curl_connecttimeout] => 30
            [curl_timeout] => 10
            [curl_ssl_verifyhost] => 2
            [curl_ssl_verifypeer] => 1
            [curl_cainfo] => /home/content/00/6684400/html/html-tweetcomments/to/cacert.pem
            [curl_capath] => /home/content/00/6684400/html/html-tweetcomments/to
            [curl_followlocation] => 
            [curl_proxy] => 
            [curl_proxyuserpwd] => 
            [curl_encoding] => 
            [is_streaming] => 
            [streaming_eol] => 

            [streaming_metrics_interval] => 60
            [as_header] => 1
            [debug] => 
            [multipart] => 
        )

    [method] => POST
    [url] => https://api.twitter.com/oauth/access_token
    [signing_params] => oauth_consumer_key=htxmSKEwkd5jPB6z1bQI6Q&oauth_nonce=adb19fb2bc5f76060b63bcbb1b3e2b94&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1329438683&oauth_token=g3ekXAg9SwoYIge2l1E6JGwIQ02QYiha8uz5TMVA&oauth_verifier=vOrM6QWwGRpTEWgE2Kk2Y87DL1mlx324r4wh2SsUo&oauth_version=1.0
    [auth_params] => Array
        (
            [oauth_consumer_key] => htxmSKEwkd5jPB6z1bQI6Q
            [oauth_nonce] => adb19fb2bc5f76060b63bcbb1b3e2b94
            [oauth_signature] => E5Vb62A00L8Nj8uyt9MRKdFk6ck%3D
            [oauth_signature_method] => HMAC-SHA1
            [oauth_timestamp] => 1329438683
            [oauth_token] => g3ekXAg9SwoYIge2l1E6JGwIQ02QYiha8uz5TMVA
            [oauth_verifier] => vOrM6QWwGRpTEWgE2Kk2Y87DL1mlx324r4wh2SsUo
            [oauth_version] => 1.0
        )

    [request_params] => Array
        (
        )

    [base_string] => POST&https%3A%2F%2Fapi.twitter.com%2Foauth%2Faccess_token&oauth_consumer_key%3DhtxmSKEwkd5jPB6z1bQI6Q%26oauth_nonce%3Dadb19fb2bc5f76060b63bcbb1b3e2b94%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1329438683%26oauth_token%3Dg3ekXAg9SwoYIge2l1E6JGwIQ02QYiha8uz5TMVA%26oauth_verifier%3DvOrM6QWwGRpTEWgE2Kk2Y87DL1mlx324r4wh2SsUo%26oauth_version%3D1.0
    [signing_key] => fmNsDdu809uAARz0EslIL5Tj9m3XxLuaTVg6RSVnAQ&4K8chxSWwwQ5nk1HSQrrbNW23FIGWiNLMycoqqxUV0
    [auth_header] => OAuth oauth_consumer_key="htxmSKEwkd5jPB6z1bQI6Q", oauth_nonce="adb19fb2bc5f76060b63bcbb1b3e2b94", oauth_signature="E5Vb62A00L8Nj8uyt9MRKdFk6ck%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1329438683", oauth_token="g3ekXAg9SwoYIge2l1E6JGwIQ02QYiha8uz5TMVA", oauth_verifier="vOrM6QWwGRpTEWgE2Kk2Y87DL1mlx324r4wh2SsUo", oauth_version="1.0"
    [response] => Array
        (
            [headers] => Array
                (
                    [date] => Fri, 17 Feb 2012 00:31:23 GMT
                    [status] => 401 Unauthorized
                    [x_mid] => 1195d712f355657dc7944ba32517310a873d29e1
                    [x_revision] => DEV
                    [x_runtime] => 0.01222
                    [x_transaction] => c84c1b7c659ad830
                    [cache_control] => no-cache, no-store, must-revalidate, pre-check=0, post-check=0
                    [x_frame_options] => SAMEORIGIN
                    [expires] => Tue, 31 Mar 1981 05:00:00 GMT
                    [content_type] => text/html; charset=utf-8
                    [last_modified] => Fri, 17 Feb 2012 00:31:23 GMT
                    [pragma] => no-cache
                    [set_cookie] => _twitter_sess=BAh7CDoPY3JlYXRlZF9hdGwrCN1yuIg1ASIKZmxhc2hJQzonQWN0aW9uQ29u%250AdHJvbGxlcjo6Rmxhc2g6OkZsYXNoSGFzaHsABjoKQHVzZWR7ADoHaWQiJWEz%250AMDBiNmY2YmVhODIxZjVlOGMzZjRiODYyMTMzOWRh--d554d0fb6e5d23c9c9a8a10bd72c968c5872ff88; domain=.twitter.com; path=/; HttpOnly
                    [vary] => Accept-Encoding
                    [content_encoding] => gzip
                    [content_length] => 21
                    [server] => tfe
                )

            [code] => 401
            [response] =>  
            [info] => Array
                (
                    [url] => https://api.twitter.com/oauth/access_token
                    [content_type] => text/html; charset=utf-8
                    [http_code] => 401
                    [header_size] => 1047
                    [request_size] => 541
                    [filetime] => -1
                    [ssl_verify_result] => 0
                    [redirect_count] => 0
                    [total_time] => 0.52167
                    [namelookup_time] => 3.3E-5
                    [connect_time] => 0.119133
                    [pretransfer_time] => 0.380061
                    [size_upload] => 0
                    [size_download] => 21
                    [speed_download] => 40
                    [speed_upload] => 0
                    [download_content_length] => 21
                    [upload_content_length] => -1
                    [starttransfer_time] => 0.521456
                    [redirect_time] => 0
                    [request_header] => POST /oauth/access_token HTTP/1.1
User-Agent: tmhOAuth 0.61+SSL - //github.com/themattharris/tmhOAuth
Host: api.twitter.com
Accept: */*
Accept-Encoding: deflate, gzip
Authorization: OAuth oauth_consumer_key="htxmSKEwkd5jPB6z1bQI6Q", oauth_nonce="adb19fb2bc5f76060b63bcbb1b3e2b94", oauth_signature="E5Vb62A00L8Nj8uyt9MRKdFk6ck%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1329438683", oauth_token="g3ekXAg9SwoYIge2l1E6JGwIQ02QYiha8uz5TMVA", oauth_verifier="vOrM6QWwGRpTEWgE2Kk2Y87DL1mlx324r4wh2SsUo", oauth_version="1.0"


                )

            [error] => 
            [errno] => 0
        )

)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T13:12:46+00:00Added an answer on June 9, 2026 at 1:12 pm

    I faced this same situation -beating my head on the wall- and finally, finally found an answer! While I get the same tmhOAuth error output as you with the 401 code, my error log indicated an Undefined variable _SESSION. From this SO question, I found all you need is a session_start(). Check all your include and required files and actual script (even in if/else conditions) and see if you didn’t destroy a session or just simply didn’t start one.

    I hope this helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to develop a web application that mainly uses PHP but i'm using
Trying to develop using MVVM: I have this Csla.PropertyStatus control that is created in
I am trying to develop a Twitter based iPhone application which needs to send
I am trying develop an application (C#) to query an LDAP server. I don't
Im trying to develop an application that should show a map using the Google
I am trying to develop an application for my localhost on which I can
I am trying to develop an application to forward received SMS to a web
trying to develop web form using jquery. all i need is to have several
Im trying to develop a friends module to get more aquainted with django. Now
I am trying to develop a multi-screen app for the Google TV platform using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.