Questions about getting information about PHP
$baidu = "http://www.baidu.com/s?wd=site%3Ahao123.com";
$site =file_get_contents ($baidu);
$site = Iconv ("UTF-8", "GB2312", $site);
Ereg ("(.*)", $site, $count);
Print_r ($count); Get the number of good topics included in Baidu
?>
This will get the result: Array ([0] = [1] = Baidu search _site:hao123.com)
But:
$baidu = "http://www.baidu.com/s?wd=site%3Ahao123.com";
$site =file_get_contents ($baidu);
$site = Iconv ("UTF-8", "GB2312", $site);
Ereg ("(. *)", $site, $count);
Print_r ($count); Get the number of good topics included in Baidu
?>
This is not going to be ...
To explain, and how to get Baidu included amount ....
------Optimal Solution--------------------
Preg_match ('% found related results (. *?) A. %i ', $site, $count);
------Other Solutions--------------------
The "." Inside the regular Matches any character except "\ n" and does not match Chinese.
Preg_match ('% found related results (. *?) A. %i ', $site, $count);
As in the following:
Preg_match ('/ found the relevant result number (. *?) A. /I ', $site, $count);
------Other Solutions--------------------
Reference:
PHP code?12preg_match ('%
found related results (. *?) A. %i ', $site, $count);
In fact, this
Preg_match ('/ find the relevant number of results (. *). <\/strong>/i ', $site, $count);
is available.
------Other Solutions--------------------
% Find related results (. *?) A. % i key is the last "I" means ignoring case, if not add "I" also do not need "%"
------Other solutions--------------------
reference:
Reference:% just the start and end of the regular, you use/, #都可以的正则的开始和结束不是 ^$ first heard, teachable ...
You're talking about location matching.
------Other Solutions--------------------
% is just the start and end of the regular, you use/, #都可以的
------ Other Solutions--------------------
% is just the start and end of the regular, you use/, #都可 The start and end of the
regular is not the first time ^$ heard, educated ...
------Other Solutions--------------------
Learning, not very clear.
------Other Solution--------------------
is incorrectly written, "." You can match the Chinese
------Other Solutions--------------------
The problem is that it can be used to make good use of the regular.
------Other Solutions--------------------
Can you tell me why I want to add%?
------Other Solutions--------------------
This reply was deleted by the administrator in 2012-11-19 17:27:11