Created
June 23, 2015 20:03
-
-
Save nitriques/f59db0af0c1b88c2a9ba to your computer and use it in GitHub Desktop.
Revisions
-
nitriques created this gist
Jun 23, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,42 @@ <?php require_once(EXTENSIONS . '/remote_datasource/data-sources/datasource.remote.php'); Class datasourcetwitter extends RemoteDatasource { public $dsParamROOTELEMENT = 'twitter'; public $dsParamURL = 'https://api.twitter.com/1.1/statuses/user_timeline.json?include_entities=true&include_rts=true&screen_name=ACCOUNT_NAME&count=10'; public $dsParamFORMAT = 'json'; public $dsParamXPATH = '/'; public $dsParamCACHE = 30; public $dsParamTIMEOUT = 10; public static function prepareGateway(&$ch) { // to generate bearer token, create and app at https://apps.twitter.com/ // aand then go to http://twitter-bearer-token.herokuapp.com/ $ch->setopt('HTTPHEADER',array('Content-Type: application/x-www-form-urlencoded;charset=UTF-8')); $ch->setopt('HTTPHEADER',array('Authorization: Bearer AAAAAAAAAAAAAAAAAAAAAIu%2FfgAAAAAAK7adp...')); } public function __construct($env=NULL, $process_params=true){ parent::__construct($env, $process_params); $this->_dependencies = array(); } public function about(){ return array( 'name' => 'Twitter', 'author' => array( 'name' => 'Your name', 'website' => 'http://example.com', 'email' => '[email protected]'), 'version' => 'Symphony 2.6.1', 'release-date' => '2015-05-13T14:30:04+00:00' ); } public function allowEditorToParse(){ return true; } }