Best institute of web designing and development in Multan

ALHUDA SHORTHAND AND IT INSTITUTE

BEST WEB DESIGNING AND DEVELOPMENT INSTITUTE IN MULTAN

Twitter PHP login

The best institute of web designing and development in Multan, best web designing institute in Multan, web designing institute in Multan, web development courses in Multan,

Alhuda Shorthand & I.T Institute Multan is providing professional training of WEB DESIGNING AND DEVELOPMENT.  

Therefore, if you want to learn web designing and development with professional, completely, comprehensively, visit Alhuda Shorthand & I.T Institute, Multan and get admission. For further information contact 0300-8829545 or 0311-4029545 or www.alhudashorthand.com or visit in person.

Address: 

1st Floor Noor Plaza Opposite Women University, Ghanta Ghar to katchary Road, Multan.

                                                     Twitter PHP login

Twitter OAuth Library for PHP 

The twitter-oauth-php/index contains the Twitter OAuth library that incorporates Twitter API with PHP. You don't have to download the Twitter PHP OAuth library independently, all the necessary documents are incorporated into our Twitter Login PHP source code. 

Client Class (User.class.php) 

The User class handles the database related activities (associate, addition, and update) utilizing PHP and MySQL. It used to interface the database and addition/update Twitter account information in the clients table.

  • __construct() – Connect to the MySQL database.
  • checkUser() – Insert or update the user profile data based on the OAuth provider and ID. Returns the user’s account data as an array.

Site Settings and API Configuration (config.php)

In the config.php file, The constant variables are defined for database settings and Twitter API configuration.
Database Constants:
  • DB_HOST – Specify the database host.
  • DB_USERNAME – Specify the database username.
  • DB_PASSWORD – Specify the database password.
  • DB_NAME – Specify the database name.
  • DB_USER_TBL – Specify the table name where the user’s account data will be stored.
Twitter API Constants:
  • TW_CONSUMER_KEY – Specify the Twitter App ID.
  • TW_CONSUMER_SECRET – Specify the Twitter App Secret.
  • TW_REDIRECT_URL – Specify the Callback URL.
Call Twitter API:
  • The PHP OAuth library is used to connect with Twitter API and working with OAuth client.

Login & Get Twitter Account Data (index.php)

This file covers the Twitter API authentication process using PHP.
  • Initially, the authentication URL is generated using getAuthorizeURL() method of TwitterOAuth class and Sign in with Twitter button is displayed on the web page.
  • If the user authenticates with their Twitter account, the following happens:
    • The profile information is achieve by the Twitter account using Twitter API.
    • The account data is inserted into the database using checkUser() function of the User class.
    • The user’s account information is stored in the SESSION.
    • The Twitter profile details (First name, Last name, Username, Locale, Picture, and Profile link) is displayed on the webpage.
  • Also, the latest tweets and tweet posting form will be displayed.
    • Using the Tweet form, the logged-in user will be able to post Tweet from the website to their Twitter account.
Close Menu