About PHP to collect a page a certain number of questions, please help to write a master

Source: Internet
Author: User
About PHP to collect a page a number of questions, please help to write a master
I now want to make a Web site, need to remotely get a Web site query results, I wrote the regular some problems, always can't get the results of the desired query number. Please help the experts to solve the following:
Http://mytool.chinaz.com/baidusort.aspx?host=www.baidu.com
Above this is to query a domain name Baidu weight page, I just need to get the query structure in the "Baidu Weight of 9" This weight number,
My code is written like this:
function Baidu ($s) {
$baidu = "http://mytool.chinaz.com/baidusort.aspx?host=". $s;
$site =file_get_contents ($baidu);
Echo $site;
Preg_match (' How to write here ', $site, $count);
return $count [0];
}
$num 1=baidu ("http://www.baidu.com");
Echo ' website Baidu weights for '. $num 1;
?>
Ask a master is how to write, how to get that query Baidu weight value, thank you

------Solution--------------------
$str = file_get_contents (' data.txt ');
$nmatches = Preg_match ('/.* (. *) <\/font>/uis ', $str, $matches);
if ($nmatches) {
echo $matches [1][0]. Php_eol;
}
?>
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.