function testShow()
 {
     $client = new TwitterClient();
     $results = $client->call('showStatus', array('id' => '10557474139'));
     $this->assertTrue(is_object($results));
     print_r($results);
 }
 public function getRemoteRepository()
 {
     if (!$this->client) {
         $this->client = new TwitterClient();
     }
     if (!$this->client->isConnected()) {
         $config = array('username' => $this->Username, 'password' => $this->Password);
         try {
             $this->client->connect($config);
         } catch (Exception $zue) {
             error_log("Failed connecting to repository: " . $zue->getMessage() . "\n");
         }
     }
     return $this->client;
 }
Beispiel #3
0
 /**
  * @param string[] $query
  * @param int $since
  * @param int $store
  * @return int
  */
 public function runInternal(array $query, $since, $store)
 {
     $nextMin = null;
     $qty = 0;
     do {
         // we're not on the first iteration anymore - utilize pagination in the api
         if ($nextMin !== null) {
             $query['since_id'] = $nextMin;
         }
         $data = $this->client->searchTweets($query);
         $medias = array_map([$this, 'toMedia'], $data->statuses);
         $medias = array_filter($medias, function ($it) use($since) {
             return $it->createdAt > $since;
         });
         $n = $data->search_metadata->max_id;
         if ($n === $nextMin) {
             break;
         }
         $nextMin = $n;
         $store->insert($medias);
         $qty += count($medias);
     } while (count($medias) !== 0);
     return $qty;
 }
<?php

namespace cd;

set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__) . '/../core/');
require_once 'TwitterClient.php';
$t = new TwitterClient();
//if (!$t->test()) echo 'FAIL 1';
$x = $t->getTimeline('phonecafedrift');
print_r($x);
//XXX FUNKAR EJ NU PGA SAKNAD OAUTH SUPPORT:
//print_r( $t->getSearchResult('kex') );
//$x = $t->getFriendsTimeline();
//print_r($x);