File network/Twitter.class.php
Last commit: Wed Jul 9 00:01:45 2014 +0200 dankert Anbindung von Twitter und Facebook als Linkempfänger.
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 ?>
Downloadnetwork/Twitter.class.php
History Wed, 9 Jul 2014 00:01:45 +0200 dankert Anbindung von Twitter und Facebook als Linkempfänger. Sun, 6 Jul 2014 12:48:15 +0200 dankert Umfangreicher Umbau auf Plugin-System.