Php regular expressions are used to obtain all the URLs and link texts of a webpage. Php Tutorial regular expression get all web pages and link text $ urlwww.111cn.net; $ body @ file_get_contents ($ url); preg_match_all (href []? ([^] *) []? (. *) I, $ body, $ B php Tutorial regular expression to get all Web site and link text
$ Url = 'http: // www. bKjia. c0m ';
$ Body = @ file_get_contents ($ url );
Preg_match_all ('/href = [' "]? ([^ '"] *) ['"]?> (. *)/I ', $ body, $ B );
$ Nums = array ();
Foreach ($ B [1] as $ u ){
If (in_array ($ u, $ nums )){
Continue;
}
$ Nums [] = $ u;
$ Title = strip_tags ($ u );
Echo $ title ."
";
}
Use a regular expression to obtain all the URLs and link texts of a webpage. $ url = 'http: // www.111cn.net '; $ body = @ file_get_contents ($ url ); preg_match_all ('/href = [']? ([^ '] *) [']? (. *)/I ', $ body, $ B...