Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
JTwitter test
// We are a valid Joomla entry point.
define('_JEXEC', 1);
// Setup the base path related constant.
define('JPATH_BASE', dirname(__FILE__));
// Maximise error reporting.
ini_set('display_errors', 1);
// Bootstrap the application.
require dirname(__FILE__).'/bootstrap.php';
class TwitterApp extends JApplicationWeb
* Display the application.
function doExecute(){
$key = "lIio7RcLe5IASG5jpnZrA";
$secret = "dl3BrWij7LT04NUpy37BRJxGXpWgjNvMrneuQ11EveE";
$my_url = JUri::current();
$option = new JRegistry;
$option->set('consumer_key', $key);
$option->set('consumer_secret', $secret);
$option->set('callback', $my_url);
$option->set('sendheaders', true);
$oauth = new JTwitterOAuth($option);
//$access_token = $obj->getStoredToken();
$new_token = $oauth->authenticate();
// Store the new access token.
/*if ($new_token != $access_token)
$twitter = new JTwitter($oauth);
$friends = $twitter->friends;
//$response = $friends->getFriendshipsLookup('testuse70078234');
$statuses = $twitter->statuses;
$response = $statuses->tweet('Testing JTwitter code.');
$web = JApplicationWeb::getInstance('TwitterApp');
JFactory::$application = $web;
$session = JFactory::getSession();
if($session->isActive() == false){
// Run the application
Copy link

rsurjano commented Apr 28, 2014

but you can do a module to test, because i test your code and appear me error 500 :( help me plz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment