Capture and classify data using DOMDocument: http://smart-phones.biyixia.com/node/1013< ;? Php/** & nbsp; * & nbsp; Created & nbsp; by & nbsp; PhpStorm. & nbsp; * & nbsp; User: & nbsp; Admin & nbs use DOMDocument to capture and classify data
Http://smart-phones.biyixia.com/node/1013
/**
* Created by PhpStorm.
* User: Admin
* Date: 13-11-14
* Time: PM
*/
$ Link [] = array ();
$ Page_url = 'http: // smart-phones.biyixia.com/node/1013 ';
// $ Content = get_data ($ page_url );
$ Doc = new DOMDocument ();
@ $ Doc-> loadHTMLFile ($ page_url );
$ Div_contents = $ doc-> getElementsByTagName ('div ');
Print_r ($ div_contents );
Foreach ($ div_contents as $ div_content ){
$ Items = $ div_content-> getAttribute ("class ");
$ Itme_value = $ items-> nodeValue;
}
Echo $ items_value;
What I want is: Cell phone size => XXXX
Product Price => XXXX
Sorry for your guidance !!! Share:
------ Solution --------------------
You all use xpath. do you want to ask?
You can use firebug or similar plug-ins to check the xpath.