Skip to content
This repository has been archived by the owner on Mar 20, 2023. It is now read-only.
/ twitter.php Public archive
forked from dodozhang21/codebird-php

Get a user's latest tweet(s) in JSON format

License

Notifications You must be signed in to change notification settings

kgadberry/twitter.php

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 

Repository files navigation

twitter.php (extension to codebird-php)

For getting the last n tweets from a specific user's timeline.
(Can now automagically parse newlines and URLs!)

Dependencies:

Requires php5-curl and a valid Twitter application API key.

Usage:

require_once ('twitter.php'); 
// This code needs to be in the same directory as the 'twitter' folder!

$data = new get_tweets(1, 'kdude63', 'CONSUMER_KEY', 'CONSUMER_SECRET')->data();
echo $data[0]['text'];

This will return kdude63's latest tweet, and echo it onto the page.

data() or data(true) will return tweet data that is ready to be displayed on a page as HTML...
I.e - Turns URLs into links, newlines into line breaks, and makes the timestamp relative instead of absolute.

Just testing...<br>some stuff...<br>With a link: <a href="https://t.co/jZ5igXzcfk" target="_blank">https://t.co/jZ5igXzcfk</a>

While data(false) will return the raw data without doing anything to it.

Just testing...\nsome stuff...\nWith a link: https://t.co/jZ5igXzcfk

For more information on Codebird, see https://github.com/mynetx/codebird-php.

About

Get a user's latest tweet(s) in JSON format

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%