What am I doing wrong?

Hi guys,

Newbie when it comes to software development, but I'm trying to learn YQL and the proper syntax to manipulate the results in PHP.

I'm trying to access data from my private fantasy football league. Specifically, with this code, I'm simply trying to obtain the number of teams in my league. I'm getting "Zero sized reply" as the error.

Please assume my consumer and shared keys are correct, and assume my private league id is correct as well.

Any ideas as to what I'm doing wrong? Any help is greatly appreciated!

// Include the PHP SDK for YSP library.

// Define constants to store your API Key (Consumer Key) and
// Shared Secret (Consumer Secret).

$session=YahooSession::requireSession(API_KEY, SHARED_SECRET, APPID);
if ($session == NULL) {
// Print error message and and then exit the script.
print ("<p>");
print ("Error: Cannot get session object.");
print (" Check your API Key (Consumer Key) and Shared Secret (Consumer Secret)");
print ("</p>");

$yqlUrl = "http://query.yahooapis.com/v1/public/yql";

$query = "select * from fantasysports.leagues where league_key='242.l.xx'";

$queryUrl = $yqlUrl . "?q=" . urlencode($query) . "&format=json";

$session = curl_init($queryUrl);

curl_setopt($session, CURLOPT_RETURNTRANSFER, true);

$json = curl_exec($session);


$yqlObject = json_decode($json);

foreach($yqlObject->query->results->league as $team){
$num_teams= $team->num_teams;
echo $num_teams;



1 Reply
  • I think the issue would be that you're trying to make a public call to get private data -- if you actually want to get private data through the webservices or the YQL API interface, you'll need to go through the whole 3-legged OAuth excitement. I think this guy was having a similar issue, see if the responses help clarify what's going on here:


    If any of you other guys on this forum have experience using the YahooSession libraries for making private calls, feel free to drop some examples here! I actually haven't played around with it yet.

Recent Posts

in Fantasy Sports API