3v4l.org

run code in 300+ PHP versions simultaneously
<?php require_once("TwitterAPIExchange.php"); class Tweet extends TwitterAPIExchange { //Enter your details here const oauth_token = "16127841-XhE5Xlw8bArFmSyouf4y9AHx9KUJ2SrpL95994QV0"; const oauth_secret = "wtmbZlSntIXpKqiq4mIDmY1JqqmsIP6FCy1UyHRI9DuJ6"; const consumer_key = "hccV6YwzcYC9bjaTnbC6W6h2D"; const consumer_secret = "OucJEZ0GR6PgGSHZje0DLSmGdSmyXx9b0CWiSGVwla1jzApSdM"; public $json; public $get; private $twitter; public function __construct() { $settings = array('oauth_access_token' => self::oauth_token, 'oauth_access_token_secret' => self::oauth_secret, 'consumer_key' => self::consumer_key, 'consumer_secret' => self::consumer_secret); $this->twitter = new TwitterAPIExchange($settings); return $this; } public function set($json, $get) { $this->json = "https://api.twitter.com/1.1/".$json.".json"; if(is_array($get)) { $this->get = http_build_query($get); } else { $this->get = $get; } return $this; } public function call() { $response=$this->twitter->setGetfield("?".$this->get) ->buildOauth($this->json, "GET") ->performRequest(); $response=json_decode($response, true); return (array) $response; } } ?>

preferences:
50.16 ms | 402 KiB | 5 Q