Possible Duplicate:
How to parse and process HTML/XML with PHP?
I want to grab anything thats inside the code below on a website.
<table class="eventResults byEvent vevent"></table>
How can I accomplish this? Thanks
If you want to grab HTML from a site, you will want to use a DOM Parser. PHP has several XML processing packages to help you with this, be it DOM, SimpleXML or XMLReader. An often suggested alternative at SO is SimpleHtmlDom.
Since one of the class in the table is vevent
, the content inside the table could be an hCalender microformat (can't tell for sure without seeing the content). If so, you can also use a microformat parser, preferably Transformr to save you the work of manually parsing the event data.
You can use the file_get_contents
function or the curl
extension for that.
First fetch the content of the whole page from that website as a string, then use regular expression to extract the substring inside table tags.
精彩评论