Foros del Web » Creando para Internet » Sistemas de gestión de contenidos » WordPress »

Api twitter 1.1 problemas

Estas en el tema de Api twitter 1.1 problemas en el foro de WordPress en Foros del Web. Hola estoy usando esta funcion y la llamo asi <?php get_tweet(); ?> pero no me esta funcionando , no me devuelve nada que puedo hacer ...
  #1 (permalink)  
Antiguo 17/03/2014, 11:45
 
Fecha de Ingreso: enero-2012
Mensajes: 224
Antigüedad: 12 años, 3 meses
Puntos: 1
Api twitter 1.1 problemas

Hola estoy usando esta funcion y la llamo asi

<?php get_tweet(); ?>


pero no me esta funcionando , no me devuelve nada que puedo hacer
Código:
function get_tweet() {
 
require 'wp-content/themes/vhm2014/twitteroauth/tmhOAuth.php';
 
$tmhOAuth = new tmhOAuth(array(
 'consumer_key' => 'key here',
 'consumer_secret' => 'key here',
 'user_token' => 'key here',
 'user_secret' => 'key here',
 'curl_ssl_verifypeer' => false
));
 
$code = $tmhOAuth->request('GET', $tmhOAuth->url('1.1/statuses/user_timeline'), array(
 'screen_name' => 'simplistips',
 'count' => '1'));
 
$response = $tmhOAuth->response['response'];
$tweets = json_decode($response, true);
echo($tweets[0]['text']);
 
}
  #2 (permalink)  
Antiguo 17/03/2014, 12:10
Avatar de rottenp4nx  
Fecha de Ingreso: octubre-2012
Ubicación: Santiago
Mensajes: 417
Antigüedad: 11 años, 6 meses
Puntos: 36
Respuesta: Api twitter 1.1 problemas

el recurso no termina en .json ?

saludos
  #3 (permalink)  
Antiguo 18/03/2014, 07:20
 
Fecha de Ingreso: enero-2012
Mensajes: 224
Antigüedad: 12 años, 3 meses
Puntos: 1
Respuesta: Api twitter 1.1 problemas

podrias darme ejemplo porfavor?
  #4 (permalink)  
Antiguo 18/03/2014, 13:27
Avatar de rottenp4nx  
Fecha de Ingreso: octubre-2012
Ubicación: Santiago
Mensajes: 417
Antigüedad: 11 años, 6 meses
Puntos: 36
Respuesta: Api twitter 1.1 problemas

Código PHP:
Ver original
  1. $tmhOAuth->url('1.1/statuses/user_timeline.json')

Intenta así

Saludos
  #5 (permalink)  
Antiguo 19/03/2014, 09:27
 
Fecha de Ingreso: enero-2012
Mensajes: 224
Antigüedad: 12 años, 3 meses
Puntos: 1
Respuesta: Api twitter 1.1 problemas

igual no me muestra nada?¡

algun script para mostrar ultimos tweest para recomendar?
  #6 (permalink)  
Antiguo 19/03/2014, 12:53
Avatar de TMeister
Crazy Coder
 
Fecha de Ingreso: enero-2002
Ubicación: En la Oficina
Mensajes: 2.880
Antigüedad: 22 años, 3 meses
Puntos: 193
Respuesta: Api twitter 1.1 problemas

Pregunta: ¿Haz puesto las llaves de tu app?

Código PHP:
Ver original
  1. 'consumer_key' => 'key here',
  2.  'consumer_secret' => 'key here',
  3.  'user_token' => 'key here',
  4.  'user_secret' => 'key here',
  #7 (permalink)  
Antiguo 24/03/2014, 12:43
 
Fecha de Ingreso: enero-2012
Mensajes: 224
Antigüedad: 12 años, 3 meses
Puntos: 1
Respuesta: Api twitter 1.1 problemas

cambie el codigo por esto , ahora me devuelve un choclo medio raro
y si lo uso dentro de wordpress no me funciona


Código:

<?php
session_start();
require_once("twitteroauth/twitteroauth.php"); //Path to twitteroauth library
 
$twitteruser = "usuario";
$notweets = 30;
$consumerkey = "5Sep7w9sKyZZbsdsd8fQ";
$consumersecret = "P8CkWeXukQtGo3hEQsdsA7hZCWVswwkQd4kUGFI";
$accesstoken = "177342424-n7l6qzBBXJCDdsdsHhvnq83yk51ari4iisJkoTz";
$accesstokensecret = "wDxhJkYCkoZpgMlGsdsds8msr4oMnBuyESe3TBO2NA";
 
function getConnectionWithAccessToken($cons_key, $cons_secret, $oauth_token, $oauth_token_secret) {
  $connection = new TwitterOAuth($cons_key, $cons_secret, $oauth_token, $oauth_token_secret);
  return $connection;
}
 
$connection = getConnectionWithAccessToken($consumerkey, $consumersecret, $accesstoken, $accesstokensecret);
 
$tweets = $connection->get("https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=".$twitteruser."&count=".$notweets);
 
echo json_encode($tweets);
?>
cambie uso esto https://github.com/abraham/twitteroauth.git

Etiquetas: 1-1, api, php, twitter
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 19:24.