Off

Post On Twitter From a PHP Script

  • First Of All Download tmhOAuth Library  from Github.
  • After downloading  drop the tmhOAuth folder into Project Folder.
  • And then include the tmhOAuth.php on the particular page.
  • Example:
    include 'tmhOAuth/tmhOAuth.php';
  • We  have to get our access tokens from dev.twitter.com/apps .
    • After login in to Twitter account.Click the big “Create a new application” button and fill in the required fields.Or Click ontoyour app which you have created through twitter.
    • After Filling Form go to Details  Tab and get the
      • Consumer Key
      • Consumer Secret
      • Access token
      • Access Secret
  • After  that put all values to the page on which we have included tmhOAuth folder.
include 'tmhOAuth/tmhOAuth.php';
$msg = 'HELLO YOUR MESSAGE';
$tmhOAuth = new tmhOAuth(array(
             'consumer_key' => 'ykovIIDDbnl913ibC3WrQ',
            'consumer_secret' => 'LYgsSTYr1G8ks3UEHOuZAeU52jGRGGp9lYf3smf8',
            'token' => '1037056429-nbJJW8Hnmjhp1LCUsjZo8jGrTcV9pdRh5SeItj0',
            'secret' => '4X6TFw8KwWWiv79Oo0WSSq6h5dG3tfprv0rtwjS5TW4',
        ));
        $response = $tmhOAuth->request('POST', $tmhOAuth->url('1.1/statuses/update'), array(
            'status' => $msg
        ));
0