Collect regular expressions
New product area
Warm top
- Fake two (shirt collar)
- V-neck women's clothing
The above is the level-1 category that I matched
$ Dafht = '# (. *) # iUs ';
Preg_match_all ($ dafht, $ fenlei, $ dafenlei );
But it is invalid.
A level-1 classification is mainly used to collect the numerical ID of the category-907362761.htm and the following name
Level 2 collection category-907362761.htm parentCatId = 907362759 the two digit IDs and the names
How can I write a card for a long time?
Reply to discussion (solution)
Level 1 :/.*? <\/H4>/isU, not tested. I don't know if it can match
Level 2 classification is not clear
Why bother writing this? If the website is slightly changed, the effort will be wasted.
There are many simple and practical tools on the internet. why not?
For example
$ S = <TXTNew product area
Warm top
- Fake two (shirt collar)
- V-neck women's clothing
TXT; include 'simple _ html_dom.php '; $ p = new simple_html_dom; $ p-> load ($ s); foreach ($ p-> find ('A ') as $ v) {echo $ v-> class, PHP_EOL; // This is the class echo $ v-> href, PHP_EOL that can be distinguished; // This is url echo trim ($ v-> innertext (), PHP_EOL; // This is the description text}
Cat-name fst-cat-name http://bosidengny.tmall.com/category-907362758.htm? Search = y & catName = % D0 % C2 % C6 % B7 % D7 % A8 % C7 % F8 cat-name fst-cat-namehttp: // bosidengny.tmall.com/category-907362759.htm? Search = y & catName = % B1 % A3 % C5 % AF % C9 % CF % D7 % B0 warm Top cat-name snd-cat-namehttp: // bosidengny.tmall.com/category-907362760.htm? Search = y & parentCatId = 907362759 & parentCatName = % B1 % A3 % C5 % AF % C9 % CF % D7 % B0 & catName = % BC % D9 % C1 % BD % BC % FE % A3 % A8 % B3 % C4 % C9 % C0 % C1 % EC % A3 % A9 fake two (shirt collar) cat-name snd-cat-namehttp: // bosidengny.tmall.com/category-907362761.htm? Search = y & parentCatId = 907362759 & parentCatName = % B1 % A3 % C5 % AF % C9 % CF % D7 % B0 & catName = V % C1 % EC % C9 % CF % D7 % B0V collar