Exemplo n.º 1
0
     $tweets = $twitter->searchTweets('taylorswift', 50);
     dump($tweets);
     return 'codezero/twitter';
 });
 /**
  * Registers the GET route to the thujohn/twitter package test page.
  */
 Route::get('/twitter/thujohn', function () {
     $search_results = Twitter::getSearch(['q' => 'taylorswift', 'lang' => 'en', 'result_type' => 'popular']);
     dump($search_results);
     echo '<h1>Tweets</h1>';
     foreach ($search_results->statuses as $tweet) {
         // $info = Oembed::cache(Twitter::linkTweet($tweet), []);
         // echo $info->code;
         echo '<iframe class="twitter-tweet" ';
         echo '        src="http://twitframe.com/show?url=', urlencode(Twitter::linkTweet($tweet)), '"';
         echo '        frameborder="0"';
         echo '        height="480">';
         echo '</iframe>';
         // echo Twitter::linkify($tweet),
         //     '<br/><a href=',
         //     Twitter::linkTweet($tweet), '>',
         //     Carbon\Carbon::createFromFormat('D M d H:i:s P Y',
         //         $tweet->created_at),
         //     '</a><br/><br/>';
     }
     return 'thujohn/twitter';
 });
 /**
  * Registers the GET route to the vinkla/instagram package test page.
  */
Exemplo n.º 2
0
 /**
  * Creates an \App\Post model object from specified Twitter $tweet object.
  *
  * @param  object $tweet Twitter tweet to convert to to a Post model
  * @return object
  */
 protected function createPostTwitter($tweet)
 {
     // create post
     $post = new Post();
     $post->provider = Post::PROVIDER_TWITTER;
     $post->uri = \Twitter::linkTweet($tweet);
     $post->source_time = \Carbon\Carbon::createFromFormat('D M d H:i:s P Y', $tweet->created_at)->toDateTimeString();
     $post->text = \Twitter::linkify($tweet);
     return $post;
 }