Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7691741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:41:38+00:00 2026-05-31T20:41:38+00:00

been fooling around with YQL trying to understand it a little better. I’ve managed

  • 0

been fooling around with YQL trying to understand it a little better. I’ve managed to pull the info I want from an external site and get a results node in the YQL console but have thus been unsuccessful in displaying the results on my local development server.

What I ultimately want to do is try and put this into a wordpress function so I can call it on a page (for example the standings page).

The code I used in php (edit:: I changed the code to this)

ini_set('display_errors', 1);
    ini_set('log_errors', 1);
    error_reporting(E_ALL);

    $yql_base_url ="http://query.yahooapis.com/v1/public/yql";
    $yql_query = 'SELECT * FROM html WHERE url="http://www.nwjhl.com/leagues/standingsTotals.cfm?leagueID=15654&clientID=4594" AND xpath=\'//table[@class="yuiboxscores"]/tbody/tr\'';

    $yql_query_url = $yql_base_url . "?q=" . urlencode($yql_query);
    $yql_query_url .= "&format=json";

    // set up the cURL
    $c = curl_init();
    curl_setopt($c, CURLOPT_URL, $yql_query_url);
    curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($c, CURLOPT_SSL_VERIFYHOST, false);

    // execute the cURL
    $rawdata = curl_exec($c);
    curl_close($c);

    // Convert the returned JSON to a PHP object
    $data = json_decode($rawdata);

I’ve managed to get the data Im looking for now Im just having trouble pulling the data in as Im assuming its because the “tr” is in an array.

Ive been probably staring at its probably a little to complex for figuring with YQL for me, I figure a for loop is needed, I just unsure of how to reference the [content] and then of course all the other numbers. I tried to debug with

$results = $data->query->results->td;
    echo '<pre>' . print_r($results) . '</pre>';

Im not sure how I would be able to loop through all these objects a arrays to display [content] (which is the team) and then of course there statistics. Continuing to work on this hopefully I can figure out

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T20:41:39+00:00Added an answer on May 31, 2026 at 8:41 pm

    The json you are getting back from that URL is not what you expect it to be. Try

    echo $output
    

    right after curl_close($ch);

    then running it through a json formatter (google it). $data->query->results works, but there is no child called Result, it just seems to be a jsonified html table of some sort.

    Once you see the JSON in a more human readable format your problem might make more sense to you.

    Per your Edit – Try this after you json_decode the raw data. I’m not sure exactly what pieces of data you are after, but I’m guessing it will be in the objects you are dumping with var_dump

    $topics = $data->query->results->table->tbody->tr;
    foreach ($topics as $topic)
       {
       echo "row:";
       var_dump($topic);
       }
    

    Here’s a more specific example of how to loop through this and find

    elements

    $topics = $data->query->results->table->tbody->tr;
    foreach ($topics as $topic)
       {
       $data = $topic->td;
       foreach ($data as $element)
          {
          if (array_key_exists('a', $element))
             {
             echo "Team Name: " . $element->a->content . "\n";
             }
          if (array_key_exists('p', $element))
             {
             echo "Found P: " . $element->p . "\n";
             }
          }
       }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've just been fooling around with a ListBox control that I want to style
I've been fooling around with OpenCV and want to continue working with it, but
I'm trying to split strings in a rather specific way. I've been fooling around
So I have been fooling around with Pygame and have run into a problem
I've been fooling around with the indentation on this for a while now, but
I've been fooling around with code for ages on this one, I would be
I'm new to using XPath so I've been fooling around with an XPath Evaluator
I had been fooling around with an initial splash screen but decided not to
I've been fooling around with custom fonts in Android. I know how to import
Hey all I've just been fooling around with the HTML5 Database API and I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.