Twitter.class.php (938B)
1 <?php 2 3 class Twitter 4 { 5 public $config; 6 public $debug; 7 8 public $url; 9 public $shortUrl; 10 public $text; 11 public $subject; 12 13 public function push() 14 { 15 require_once('network/twitter/twitteroauth.php'); 16 17 $connection = new TwitterOAuth($this->config['consumer_key'],$this->config['consumer_secret'],$this->config['oauth_token'],$this->config['oauth_token_secret']); 18 19 /* If method is set change API call made. Test is called by default. */ 20 21 //$content = $connection->get(‘account/verify_credentials’); 22 23 /* Some example calls */ 24 25 $praefix = $this->config['praefix_text'].' '; 26 $suffix = ' '.$this->shortUrl.' '.$this->config['suffix_text']; 27 $text = $praefix.substr($this->subject,0,140-strlen($praefix)-strlen($suffix)).$suffix; 28 29 $result = $connection->post('statuses/update', array('status' => $text)); 30 31 if ( $this->debug ) 32 { 33 echo '<pre>'; 34 print_r( $result ); 35 echo '</pre>'; 36 } 37 38 } 39 } 40 ?>