Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

177
Vistas
Respuesta vacía de error de PHP

El código php a continuación debería funcionar, sin embargo, recibo un error, una respuesta vacía, de mi servidor. Intenté apagar el firewall pero no tuve suerte. ¿Pueden ayudarme? He estado probando diferentes métodos durante mucho tiempo. No tengo idea de qué es lo que falla. Gracias.

 <?php require_once('TwitterAPIExchange.php'); /** Set access tokens here - see: https://dev.twitter.com/apps/ **/ $settings = array( 'oauth_access_token' => "", 'oauth_access_token_secret' => "", 'consumer_key' => "", 'consumer_secret' => "" ); $url = "https://api.twitter.com/1.1/search/tweets.json"; $requestMethod = "GET"; $getfield = '?q=cloud%20computing&count=5&result_type=popular'; $twitter = new TwitterAPIExchange($settings); echo $twitter->setGetfield($getfield) ->buildOauth($url, $requestMethod) ->performRequest(); ?>
over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

necesita usar json_decode: http://php.net/manual/en/function.json-decode.php

 <?php error_reporting(E_ALL); ini_set("display_errors", 1); require_once('TwitterAPIExchange.php'); $settings = array( 'oauth_access_token' => "xxx", 'oauth_access_token_secret' => "xxx", 'consumer_key' => "xxx", 'consumer_secret' => "xxx" ); $url = "https://api.twitter.com/1.1/search/tweets.json"; $requestMethod = "GET"; $getfield = '?q=cloud%20computing&count=5&result_type=popular'; $twitter = new TwitterAPIExchange($settings); $response = $twitter->setGetfield($getfield) ->buildOauth($url, $requestMethod) ->performRequest(); $string = json_decode($response, true); // there you handle twitter response print_r($string); // here is the echo'd result, not needed after // from here, you have access to the data // then, a foreach loop will give you access to whatever you want to echo foreach($string['statuses'] as $tweets) { $tweet = $tweets['text']; echo "<p>Tweet: $tweet </p>"; } ?>

actualizado con el ejemplo de bucle

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda