Hello to all. I'm creating a miniature sports site where I'm referencing some schedule information from a professional sports team. I'm trying to grab some HTML from another site and I'm using cURL to do it. I've successfully grabbed the HTML and created a DOM instance as well as successfully loaded the HTML using:
The problem I'm having is that certain <div> tags that I'm targeting are coming up as NULL. I'm referencing certain id's like "element1" and "element6" and I'm getting nothing. I'm thinking that I'm not referencing what I want correctly. I do know that what is returned is an object, but I'm missing something. Any suggestions?PHP Code:$bears_games = new DOMDocument();
$bears_games->loadHTML($bears_html);
Here's my full cURL code:
PHP Code:$ch = curl_init('http://www.chicagobears.com/gameday/schedule.html');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
$bears_html = htmlspecialchars(curl_exec($ch));
$bears_games = new DOMDocument();
$bears_games->loadHTML($bears_html);
var_dump($bears_games->getElementsByTagName('div')->item(0));
curl_close($ch);


Reply With Quote
Bookmarks