Search code examples
phpfacebookyql

How to fix error of No definition found for table?


Does anyone know why I am getting the below error message? I am starting to learn the world of Facebook development and I cannot find a simple answer.

Code:

$twitterUrl ="http://query.yahooapis.com/v1/public/yql?q=";
$twitterUrl .= urlencode("select * from twitter.status where id='jzm'");
$twitterUrl .="&format=json";

$twitterFeed = file_get_contents($twitterUrl, true);
$twitterFeed = json_decode($twitterFeed);

print_r($twitterFeed);

Error received:

stdClass Object ( [error] => stdClass Object ( [lang] => en-US [description] => No definition found for Table twitter.status ) )

Solution

  • Try adding &env=http://datatables.org/alltables.env to your query.

       $twitterUrl ="http://query.yahooapis.com/v1/public/yql?q=";
        $twitterUrl .= urlencode("SELECT * FROM twitter.status WHERE id='jzm'");
        $twitterUrl .="&format=json";
        $twitterUrl .="&env=http://datatables.org/alltables.env";
    
        $twitterFeed = file_get_contents($twitterUrl, true);
        $twitterFeed = json_decode($twitterFeed);
    
        print_r($twitterFeed);