Friends, I am trying to get the data of Twitter users by ID, via API, but as I'm using WHILE is VERY slow. My script is correct? Can you help me find a solution?
PHP Code:<?php
require_once('config.php');
function user($id){
$jsonurl = "https://api.twitter.com/1/users/show.json?id=".$id."&include_entities=true";
//Retorna o conteudo do arquivo em formato de string
$json = file_get_contents($jsonurl,0,null,null);
//Decodificando a string e criando o json
$json_output = json_decode($json);
return $json_output->screen_name;
}
function img($id){
$jsonurl = "https://api.twitter.com/1/users/show.json?id=".$id."&include_entities=true";
//Retorna o conteudo do arquivo em formato de string
$json = file_get_contents($jsonurl,0,null,null);
//Decodificando a string e criando o json
$json_output = json_decode($json);
return $json_output->profile_image_url;
}
$sql = mysql_query("SELECT * FROM content");
while ( $filter = mysql_fetch_object($sql) )
{
echo '<img src="'.img($filter->user).'" width="50" height="50" alt="" /><br />';
echo user($filter->user). '<br /><br />';
}



Reply With Quote

Bookmarks