Jump to content

pull other sites html??


dadamssg

Recommended Posts

I'm trying to create a mac widget that will display my college's football schedule. How do i get started pulling the table data of this page? or any webpage for that matter? It doesn't appear to wrapped in any kind of xml

 

http://www.aggieathletics.com/sports/m-footbl/sched/tam-m-footbl-sched.html

 

The html is about 3/4 of the down in the source code.

Link to comment
Share on other sites

I'm trying to create a widget to display different college football schedules. I know the simple html dom plug in will do the trick, i just don't know how to find dom objects. I want to grab a table with the id of "schedtable" and display its contents. Any advice or help would be much appreciated!

 

this is what i got so far...not much haha

<?php
include("simple_html_dom.php");

// Create DOM from URL or file
$html = file_get_html('http://www.aggieathletics.com/sports/m-footbl/sched/tam-m-footbl-sched.html');

//code to display the schedule table????

?>

 

Link to comment
Share on other sites

could you should me or point me in a direction as to where i can learn how to do that?

 

this is the tutorial im going off of but it doesn't work with another site.

// Create DOM from string
$html = str_get_html('<div id="hello">Hello</div><div id="world">World</div>');

$html->find('div', 1)->class = 'bar';

$html->find('div[id=hello]', 0)->innertext = 'foo';

echo $html; // Output: <div id="hello">foo</div><div id="world" class="bar">World</div>

 

heres what i have thats not workin

<?php
include("simple_html_dom.php");

// Create DOM from URL or file
$html = file_get_html('http://www.aggieathletics.com/sports/m-footbl/sched/tam-m-footbl-sched.html');

$html->find('table[id=schedtable]');

echo $html;

?>

 

it just pulls up the entire page

Link to comment
Share on other sites

You're not echoing the result of the find... you need to put the results in a variable and echo that

 

<?php
include("simple_html_dom.php");

// Create DOM from URL or file
$html = file_get_html('http://www.aggieathletics.com/sports/m-footbl/sched/tam-m-footbl-sched.html');

$results = $html->find('table[id=schedtable]');

echo $results;

?>

 

At least that would make sense, but I'm not the brightest crayon in the box :)

 

HTH

 

Link to comment
Share on other sites

still not working..although i can pull something off of one of my own files on my server.

 

This properly displays the heading thats on a different page but still no table from the other site... :confused:

<?php
include("simple_html_dom.php");

// Create DOM from URL or file
$html = file_get_html('http://www.aggieathletics.com/sports/m-footbl/sched/tam-m-footbl-sched.html');
$test = $html = file_get_html('http://www.website.com/test/tester.html');

$table = $html->getElementById("schedtable"); 
$thing = $test->getElementById("heading"); 


echo "1<br><br>";

echo $table."<br>"; 

echo "<br>2";

echo "<hr>";

echo "3<br><br>";

echo $thing."<br>"; 

echo "<br>4";

?>

 

Link to comment
Share on other sites

success! for anyone that cares this works

<?php
include("simple_html_dom.php");

// Create DOM from URL or file
$html = file_get_html('http://www.aggieathletics.com/sports/m-footbl/sched/tam-m-footbl-sched.html');


$table = $html->getElementById("schedtable"); 


echo $table;


?>

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.