
Untitled
By: a guest on
Jun 11th, 2012 | syntax:
None | size: 0.71 KB | hits: 12 | expires: Never
<?php
// Include the phpQuery library
// Download at http://code.google.com/p/phpquery/
include 'phpQuery.php';
// Load Mike Fisher's player page on thescore.com
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://www.thescore.com/nhl/player_profiles/859-mike-fisher');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$html = curl_exec($ch);
curl_close($ch);
// Create phpQuery document with returned HTML
$doc = phpQuery::newDocument($html);
// Create array to hold stats
$stats = array();
// Add stats from page to array
// Notice the CSS style selector
foreach($doc['#career_stats_regular table tr:nth-child(1) td'] as $td)
{
$stats[] = pq($td)->html();
}
// Display stats
print_r($stats);