parsing - Open more links and then parse some elements in php -
I have a simple problem
For example, I have to open this page in PHP.
Then I need to open every state and state page (for example: Alabama), I have to parse state, capital, place name. I want to do this with the simple html dom library
and I want to do it on every state. How is this possible ???
// parser.php contains simple_html_dom.php; $ Document = file_get_html ($ site); Foreign Currency ($ document-> Search ('A') as $ E) {echo $ e-> Href '& lt; Br> & # 39; & # 39; }
So what now? Please help. I think now that I want only chairs with states and then I have to open it ... then?
Why not feed it with the state name on the URL? View this as an example:
& lt; Php included 'simple_html_dom.php'; $ State = 'Alabama'; $ Main_url = 'http://www.50states.com/' $ state '.htm'; $ Html = file_get_html ($ main_url); $ State_info = Null; $ Capital_city = ''; Find Foreign Currency ($ HTML-> ('ul [class = bulletedList]') $ key = & gt; $ value) {$ state_info = $ value; // Get special value (trosom dom) / sample: search for capital city (srpo ($ value-> children (0) -> children (0) -> internal text, 'capital city : ')) {$ Capital_city = $ value- & gt; Children (0) - & gt; Children (0) - & gt; Internal text; }} Echo $ state_info; Echo $ capital_city; ? & Gt; P> / div>
Comments
Post a Comment