There is such an HTML section, which is relatively irregular. if you want to extract the link address and link name, how can we get it?
There is such an HTML section, which is relatively irregular. if you want to extract the link address and link name, how can we get it?
// HTML
$ Str = 'Song list
Chinese score list
• Light Music ';
Using regular expressions is the simplest. other methods, even if you want to use regular expressions, are used...
$ Pat = '/(.*?) <\/A>/I ';
Preg_match_all ($ pat, $ str, $ m );
Output method:
Print_r ($ m [2]);
Print_r ($ m [4]);
Or:
For ($ I = 0; $ I Echo'
'. $ M [4] [$ I]. '';
}The result is as follows:
Array ([0] => http://list.mp3.baidu.com/song/A.htm? Top8 [1] => http://list.mp3.baidu.com/list/bangping.html [2] => qingyinyue.html? Top19) Array ([0] => Song list [1] => Chinese music list [2] => light music)
So we need to collect the title and link address of a website... Apply it by yourself...