title: Using yql and php to scrape content
body: <p>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.</p>
  
  <p>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).  </p>
  
  <p>The code I used in php (edit:: I changed the code to this)</p>
  
  <pre><code>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&amp;clientID=4594" AND xpath=\'//table[@class="yuiboxscores"]/tbody/tr\'';
  
      $yql_query_url = $yql_base_url . "?q=" . urlencode($yql_query);
      $yql_query_url .= "&amp;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);
  </code></pre>
  
  <p>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.</p>
  
  <p>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</p>
  
  <pre><code>$results = $data-&gt;query-&gt;results-&gt;td;
      echo '&lt;pre&gt;' . print_r($results) . '&lt;/pre&gt;';
  </code></pre>
  
  <p>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</p>