Twitter Application-only authentication (OAuth) with PHP

Provides a set of functions to allow authentication via Twitter's Application-only authentiation method written in PHP


Project maintained by jonhurlock Hosted on GitHub Pages — Theme by mattgraham

Welcome to jonhurlock's Twitter Application-only authentication scripts

Need to use application authentication-only authentication to access twitter. Well why not use this quick script.

To Use.

  1. Download Script
  2. Edit lines 14 and 15 to reflect your apps consumer key and consumer secret.
  3. Call the get_bearer_token() function to grab a bearer_token
  4. Query the API using the bearer token. Example shown below using the search_for_a_term function.
$bearer_token = get_bearer_token(); // get the bearer token
print search_for_a_term($bearer_token, "test"); //  search for the work 'test'

If you have any queries, contact me via twitter at @jonhurlock