The improved auto-show weather report applet (available in both Linux and Windows environments)-PHP application-PHP Tutorial -. This improvement mainly adds image acquisition and provides a complete function for obtaining remote files. The code is as follows :? $ Fcontfile (www.bjmb.gov. cntoday. as this improvement mainly adds image acquisition and provides a complete function for obtaining remote files. The 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 ("> <", "> Replace <", $ tmp );
$ Stt = split ("Shard", $ st );
Foreach ($ stt as $ key => $ value ){
If (strstr ($ value, "img ")){
$ Tmp = $ value;
If (strstr ($ tmp, "bt9.jpg") | strstr ($ tmp, "colline.gif ")){
$ Tmp = "";
} Else {
$ Tmp = ereg_replace ("", "", $ tmp );
$ 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 ");
}
Bytes. The code is as follows :? $ Fcont = file (http://www.bjmb.gov.cn/today.as...