I have a table here which is containing some data,So i want to copy that data and wants to print it on my webpage by the php script,So someone please help me out,If u dont mind anyone contribute the suitable code here for this question.
Asked
Active
Viewed 82 times
-4
-
Consider http://stackoverflow.com/questions/3577641/how-do-you-parse-and-process-html-xml-in-php/3577662#3577662 – Lance Aug 08 '13 at 20:32
-
3What. Have. You. Tried? – Pedro Estrada Aug 08 '13 at 20:32
-
1Does the website with the table/data belong to you? – Sam Creamer Aug 08 '13 at 20:33
-
1Per the flagging menu: _"Questions asking for code **must demonstrate a minimal understanding of the problem being solved**."_ You should consider showing us what you've tried and putting forth a little research effort – War10ck Aug 08 '13 at 20:40
-
Consider providing your code, or telling us what you've tried so far. – Sasanka Panguluri Aug 08 '13 at 20:44
2 Answers
1
Use a DOM Parser like SimpleHTMLDom.
include 'simple_html_dom.php';
$html = file_get_html('http://result.msrit.edu/getresult.php?myusn=1ms10cs410&B1=GET%20RESULT');
$elems = $html->find("/html/body/table/tbody/tr[1]/th[1]/div");
foreach($elems as $v)
{
//do the parsing here
}
Read the documentation for the available options and examples.
Hope this helps!

Amal Murali
- 75,622
- 18
- 128
- 150
1
$dom = new DomDocument();
@$dom->loadHTML(file_get_contents ('http://result.msrit.edu/getresult.php?myusn=1ms10cs410&B1=GET%20RESULT'));
$table=$dom->getElementsByTagName('table');
echo $dom->saveHTML($table->item(0));

trijin
- 483
- 3
- 6