To obtain the ranking digits of the keyword Baidu, use a regular expression, such as searching for csdn from Baidu. The result is as follows: HTMLcode & lt; tablecellpadding = & quot; 0 & quot; cellspacing = & quot; 0 & quot; class = & quot; result & quot; method for obtaining the number of digits in the keyword Baidu ranking, which is mainly a regular expression
For example, search for csdn from Baidu,
The result is as follows:
HTML code
Where
When the 1 in id = "1" is based on the csdn keyword, Baidu naturally ranks www.csdn.net. In "'})" href = "http://www.csdn.net/" target = "_ blank"> "this string contains the first 15th characters and is also his ranking number 1Now I can only get the entire search result from file_get_contents. how can I "extract" 1 of this id = "1? Thank you for your advice!My idea is, from "'})" href = "http://www.csdn.net this code goes forward to search for 15th notes, get him, can also.Thank you for your advice!------ Solution --------------------After, no one answered the question. it looks like they are all in a coma.$ Str ='
}';$ Pat = '/id = "([0-9]) + "/';Preg_match ($ Pat, $ Str, $ Marray );Echo $ Marray [1];
|