Home >Backend Development >PHP Tutorial >Improved 'Automatically Display Weather Forecast' applet (available in both Linux and Windows environments)_PHP tutorial
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=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