Created
August 8, 2015 17:01
-
-
Save porfidev/25743318bb7ef27aa239 to your computer and use it in GitHub Desktop.
API Twitter 2015: Mostrar los últimos 10 tweets de un usuario
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Created by PhpStorm. | |
* User: elporfirio | |
* Date: 08/08/15 | |
* Time: 10:56 | |
*/ | |
require "twitteroauth-master/autoload.php"; | |
use Abraham\TwitterOAuth\TwitterOAuth; | |
$consumer_key = "XXXX"; | |
$consumer_secret = "XXXX"; | |
$token = "XXXX"; | |
$token_secret = "XXXX"; | |
$conexion = new TwitterOAuth($consumer_key, $consumer_secret, $token, $token_secret); | |
#$contenido = $conexion->get("followers/list"); | |
$contenido = $conexion->get("statuses/user_timeline", ["screen_name" => "SaraSoueidan", "count" => 10]); | |
$html = ""; | |
$i = 1; | |
foreach($contenido as $tweet){ | |
$html .= $i . ">>> "; | |
$html .= $tweet->text; | |
$html .= "<hr>"; | |
$i ++; | |
} | |
echo $html; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Disculpa, sabes como hacer esto pero de forma streaming, que cuando publique un tweet, de forma inmediata llegue a donde tenga conectado el servicio.