Skip to content

Instantly share code, notes, and snippets.

@LegaiAA
LegaiAA / 2018-04-09-twitter-get-tweets.php
Created April 9, 2018 19:12
Seperate single tweets into an individual collection. Combine threaded Tweets / Tweet replies into combined collection.
<?php
/**
* Seperate single tweets into an individual collection.
* Combine threaded Tweets / Tweet replies into combined collection.
*/
function get_tweets($data)
{
if ($data === false) {
return 'Cannot view tweets';
@LegaiAA
LegaiAA / 2018-04-09-twitter-api-request.php
Created April 9, 2018 19:08
Twitter application-only request data from a user timeline using a bearer token.
<?php
/**
* Authenticate API requests with the bearer token
*
* The bearer token may be used to issue requests to API endpoints which
* support application-only auth. To use the bearer token, construct a normal
* HTTPS request and include an Authorization header with the value of
* Bearer <base64 bearer token value>. Signing is not required.
*
@LegaiAA
LegaiAA / 2018-04-09-twitter-api-connect.php
Created April 9, 2018 19:05
Twitter application-only authentication to connect and retrieve a bearer token.
<?php
/**
* Application-only authentication
*
* Application-only authentication is a form of authentication where an
* application makes API requests on its own behalf, without the user context.
* This method is for developers that just need to access public information.
*
* developer.twitter.com/en/docs/basics/authentication/overview/application-only
@LegaiAA
LegaiAA / twitter-threads-user-timeline.php
Last active April 10, 2018 04:05
Seperate single tweets into an individual collection, combine threaded Tweets / Tweet replies into combined collection.
<?php
/**
* Seperate single tweets into an individual collection, combine threaded
* Tweets / Tweet replies into combined collection.
*
* Application-only authentication Tweets from a designated user timeline.
* Twitter offers applications the ability to issue authenticated requests on
* behalf of the application itself (as opposed to on behalf of a specific user).
* Twitter’s implementation is based on the Client Credentials Grant flow of
* the OAuth 2 specification. Note that OAuth 1.0a is still required to issue