Home > Backend Development > PHP Tutorial > Improved 'Automatically Display Weather Forecast' applet (available in both Linux and Windows environments)_PHP tutorial

Improved 'Automatically Display Weather Forecast' applet (available in both Linux and Windows environments)_PHP tutorial

WBOY
Release: 2016-07-13 11:00:12
Original
808 people have browsed it

This improvement mainly adds image acquisition and provides a relatively complete function for acquiring remote files. The specific code is as follows:
$fcont=file("http://www.bjmb.gov.cn/today.asp");
$arr=array();
for($i=0;$i $tmp=$fcont[$i];
$tmp=ereg_replace("
"," " ,$tmp);
if(!strstr(strtolower($tmp),"img")){
$tmp=trim(strip_tags($tmp));
} else {
$ st=ereg_replace ("><",">⌒<",$tmp); > $value){
if(strstr($value,"img") ){
$tmp=$value;
if(strstr($tmp,"bt9.jpg") || strstr ($tmp,"colline.gif")){
                                                                                                          st=split("src=",$tmp);
                     $st1=split(" ",$st[1]);getpic("http://www.bjmb.gov.cn/$st1[0 ]","image");
   if(count($st)>2){
    $st2=split(" ",$st[2]);getpic("http://www. bjmb.gov.cn/$st1[0]","image");
           }




http://www.bkjia.com/PHPjc/631806.html

www.bkjia.com

truehttp: //www.bkjia.com/PHPjc/631806.htmlTechArticleThis improvement mainly increases the acquisition of images and provides a relatively complete way to obtain remote files. function. The specific code is as follows: ? $fcont=file(http://www.bjmb.gov.cn/today.as...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template