BVB Source Codes

Weather forecast PHP application v2.0 CongYang net Show index.php Source code

Return Download Weather forecast PHP application v2.0 CongYang net: download index.php Source code - Download Weather forecast PHP application v2.0 CongYang net Source code - Type:.php
  1. <?php
  2. $tqcity = "枞阳";
  3. $tqurl = "http://www.zongyang8.com/weather";
  4. $cjurl = "http://www.weather.com.cn/weather/101220602.shtml";//采集网址
  5.  
  6. $a = $_GET['a'];
  7.  
  8. function DateDiff($d1,$d2){  
  9.      if(is_string($d1))$d1=strtotime($d1);
  10.      if(is_string($d2))$d2=strtotime($d2);
  11.      return ($d2-$d1)/60;
  12. }
  13. function getContent( $sourceStr, $startStr, $endStart ){
  14.         $s = preg_quote( $startStr );
  15.         $e = preg_quote( $endStart );
  16.         preg_match_all( "@" . $s . "(.*?)". $e ."@is", $sourceStr, $tpl );
  17.         $content = $tpl[1];
  18.         $content = implode( "", $content );
  19.         return $content;
  20. }
  21.  
  22. require( "data.php" );
  23.  
  24. if (DateDiff($lasttime,time()) >= 10){//60分钟更新一次,调试改为0
  25.  
  26.         $content = implode(file($cjurl));
  27.         preg_match_all( "/<dt><a>今日日出日落时间<\\/a><\\/dt>(.*?)<dd>(.*?)<\\/dd>(.*?)<dd>(.*?)<\\/dd>(.*?)<!--day 1-->(.*?)<div class=\"weatherYubao\"(.*?)cellpadding=\"0\">(.*?)<!-- Live start-->(.*?)发布[)]\r\n      <\\/h1>(.*?)\r\n      <div class=\"cleardiv\"><\/div>/s", $content, $matches);
  28.  
  29.         $kt = explode("cellpadding=\"0\">",$matches[6][0]);
  30.         //天气图
  31.         $wpic = str_replace("\t","", str_replace("\r\n","",str_replace("/m2/i/icon_weather/29x20/",$tqurl."/images/b/",getContent(strip_tags($kt[1],"<td><img>"),"<td width=\"10%\">","</td>"))));
  32.         //echo $wpic;
  33.  
  34.         //气象
  35.         $weather = str_replace("\t","", str_replace("\r\n","",getContent(strip_tags($kt[1],"<td><img>"),"<td width=\"18%\">","</td>\r\n            <td width=\"15%\">")));
  36.         //echo $weather;
  37.  
  38.         //温度
  39.         $temperature = str_replace(" ","",str_replace("\t","", str_replace("\r\n","",str_replace("高温 ","",str_replace("低温 ","",getContent(strip_tags($kt[1],"<td><img>"),"<td width=\"15%\">","</td>\r\n            <td width=\"15%\">"))))));
  40.         //echo $temperature;
  41.  
  42.         //风向1
  43.         $wind1 = str_replace(" ","",str_replace("\t","", str_replace("\r\n","",getContent(strip_tags($kt[1],"<td><img>"),"            </td>\r\n            <td width=\"15%\">","</td>"))));
  44.         //echo $wind1;
  45.  
  46.         //风向2
  47.         $wind2 = str_replace(" ","",str_replace("\t","", str_replace("\r\n","",getContent(getContent(strip_tags($kt[1],"<td><img>"),"            </td>\r\n            <td width=\"15%\">","</td>\r\n          \r\n")."#","<td width=\"15%\">","#"))));
  48.         //echo $wind2;
  49.  
  50.         $mo = $matches[10][0];
  51.         if ($mo != ""){
  52.                 $tc .= "<div id=\"bo1\">\r\n\t<div class=\"todayt\">今天是<span id=\"Calendar\"></span><script language=\"JavaScript\">setCalendar();</script></div>";
  53.                 $tc .= "<div id=\"logo\"><a href=\"".$tqurl."\"><img src=\"./images/logo.gif\" border=0 alt=\"".$tqcity."天气预报\" /></a></div>";
  54.                 $tc .= "<div class=\"todayw\"><p>".str_replace("><",">&nbsp;<",str_replace("/m/i/icon_weather/29x20/",$tqurl."/images/b/",$wpic))."</p>";
  55.                 $tc .= "<h2>".$weather."</h2>";
  56.                 $tc .= "<h2>".$temperature."</h2>";
  57.                 $tc .= "<p>".$wind1."&nbsp;".$wind2."</p>";
  58.                 $tc .= "<p>今日日出日落时间:<font color=green>".strip_tags($matches[2][0])."</font></p>";
  59.                 $tc .= "<p>明日日出日落时间:<font color=green>".strip_tags($matches[4][0])."</font></p>";
  60.                 $tc .= "<p><font color=red>(本页数据更新时间:".date("Y-m-d H:i:s").")</font></p></div>\r\n</div>\r\n\r\n";
  61.  
  62.                 $tc .= "<div id=\"bo2\">\r\n\t<div class=\"bt\">".$tqcity."天气预报</div>\r\n\t";
  63.                 $tc .= "<table width='100%' align='center' border='0' cellpadding='0' cellspacing='0' class='tit'><tr><th width='27%'>日期</th><th width='28%'>天气现象</th><th width='15%'>气温</th><th width='15%'>风向</th><th width='15%'>风力</th></tr></table>";
  64.                 $tc .= "<table width='100%' align='center' border='0' cellpadding='0' cellspacing='0' class='tqyb_new'>";
  65.                 $tc .= str_replace("/m2/i/icon_weather/29x20/",$tqurl."/images/s/",strip_tags($matches[6][0].$matches[8][0],"<span><strong><img><td><tr>"));
  66.                 $tc .= "</table>";
  67.                 $tc .= "\r\n</div>\r\n\r\n";
  68.                 $tc .= "<div class=\"clear\"></div>\r\n\r\n";
  69.  
  70.                 $tc .= "<div id=\"bo3\">\r\n\t<div class=\"bt\">明日".$tqcity."生活指数</div>\r\n\t";
  71.                 $tc .= str_replace("</dd>","</dd>",str_replace("</p>","</dt>",str_replace("<p>","<dl><dt>",str_replace("/m2/i/indexer/zs/",$tqurl."/images/",strip_tags($matches[10][0],"<img><dt><dl><dd><b><blockquote>")))));
  72.                 $tc .= "\r\n</div>\r\n\r\n";
  73.                 $tc .= "<!-- Update:".date("Y-m-d H:i:s")." -->\r\n\r\n";
  74.  
  75.                 $data="<?
  76.                 \$lasttime=".time().";
  77.                 ?>";
  78.                 $fp0 = fopen("data.php","w");//a+,w
  79.                 fwrite( $fp0, $data);
  80.                 fclose( $fp0 );
  81.                 $fp1 = fopen("b.php","w");//a+,w
  82.                 fwrite( $fp1, $tc);
  83.                 fclose( $fp1 );
  84.                 $fp2 = fopen("a.php","w");//a+,w
  85.                 fwrite( $fp2, "document.write(\"<div style='font-size:14px;font-weight: bold;'>".str_replace("><",">&nbsp;<",str_replace("\"","'",str_replace("src=\"/m/i/icon_weather/29x20/"," align=\"absmiddle\" src=\"".$tqurl."/images/s/",$wpic)))."&nbsp;".$tqcity."天气</div><div><a href='".$tqurl."' target='_blank' title='".$weather."&nbsp;".$temperature."&nbsp;".$wind1."&nbsp;".$wind2."'>".$weather."&nbsp;&nbsp;".$temperature."</a></div>\");\r\n//Update:".date( "Y-m-d H:i:s",time()));
  86.                 fclose( $fp2 );
  87.         }
  88. }
  89.  
  90. if ( $a == "today" ){
  91.         require( "a.php" );
  92. }else{
  93. ?>
  94. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  95. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-cn">
  96. <head>
  97. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  98. <title><?= $tqcity ?>天气预报 - 枞阳县网上气象站</title>
  99. <meta name="keywords" content="<?= $tqcity ?>天气预报,<?= $tqcity ?>气温,<?= $tqcity ?>气象,<?= $tqcity ?>生活指数,<?= $tqcity ?>今日天气"/>
  100. <meta name="description" content="枞阳网(www.zongyang8.com):枞阳市天气预报;枞阳气象;枞阳未来天气;枞阳白天天气;枞阳气温;枞阳生活指数;枞阳日出时间;枞阳明日天气;枞阳天气变化"/>
  101. <meta http-equiv="refresh" content="60;URL=http://www.zongyang8.com">
  102. <style>
  103. * {margin:0;padding:0}
  104. body{margin:2px 0px; font-size:12px;}
  105. em, i{font-style: normal;}
  106. ul{list-style-type:none}
  107. a:link,a:visited{color:#194F95;text-decoration:none;}
  108. a:hover,a:active{color:#FF6600;}
  109. .clear{clear:both;height:0px;overflow:hidden;}
  110. .green {color:#009A01;}
  111. .red {color:#CC0001;}
  112. #header{width:660px;margin:0 auto;}
  113. #topnav{margin:0 auto;height:22px;padding:0px 0px 0px 2px;border-bottom:1px solid #e3e3e3;}
  114. #topnav li{float:left;padding:0px 10px;line-height: 22px;background:url(./images/tumenuj.gif) no-repeat right;}
  115. .bt{background: #3366bb;color: white;padding: 0 9px;height: 30px;line-height: 30px;overflow: hidden;font-size: 14px;font-weight: bolder;margin: 0px 10px;}
  116. #bo2{width: 660px;margin:0 auto;clear:both;}
  117. /*----- shanhe  -----*/
  118. #bo1{width: 660px;margin:0 auto;clear:both;overflow:hidden;}
  119. #bo1 .todayt{float: right;color:#ff6600;font-weight: bold;height: 30px;line-height: 30px;}
  120. #bo1 #logo{float: left;width: 210px;padding:20px 30px 0;}
  121. #bo1 .todayw{float: right;text-align: center;padding:15px 0px 0px 0px;line-height: 20px;margin:0 20px 0 0;}
  122. #bo1 .todayw p{font-weight:400;font-size:13px;}
  123. #bo1 h1,#bo1 h2{line-height:120%;font-size:20px;font-weight:700;}
  124. /*----------*/
  125. #bo2 ul.day{background:#f6f7fb;border-bottom:1px solid #99b0da;border-right:1px solid #99b0da;float:left;font-size:12px;height:36px;padding-top:17px;text-align:center;width:100px;}
  126. #bo2 ul.sunday{background:#f6f7fb;border-bottom:1px solid #99b0da;border-right:1px solid #99b0da;color:#C00;float:left;font-size:14px;font-weight:700;height:36px;padding-left:8px;padding-top:17px;width:92px;}
  127. #bo2 ul li{border-bottom:1px solid #99b0da;border-right:1px solid #99b0da;height:18px;overflow:hidden;padding-top:8px;position:relative;text-align:center;}
  128. #bo2 ul.content li{background:#f6f7fb;position:relative;width:69px;}
  129. #bo2 ul.content1 li{background:#fff;height:26px;margin-bottom:0;overflow:hidden;padding-bottom:0;padding-top:0;position:relative;width:69px;}
  130. #bo2 ul.content1 li img{border:none;display:inline;margin:0;padding:3px 0 0;}
  131. #bo2 ul.content1 li img a{display:inline;margin:0;padding:0;}
  132. #bo2 ul.content2 li{background:#fff;width:103px;}
  133. #bo2 ul.content3 li{background:#fff;color:#ff7f00;width:95px;}
  134. #bo2 ul.content3 li a{color:#e54600;}
  135. #bo2 ul.content4 li{background:#fff;width:100px;}
  136. #bo2 ul.content5 li{background:#fff;width:91px;}
  137. #bo2 ul.day1{background:#f6f7fb;border-bottom:1px solid #99b0da;border-right:1px solid #99b0da;color:#C00;float:left;font-size:12px;height:20px;padding-top:6px;text-align:center;width:100px;}
  138. .tit {margin-top:5px;border-collapse: collapse;width:634px;}
  139. .tit th {background-color:#DBE3FA;border:1px solid #99B0DA;border-bottom:none;color:#000000;font-size:14px;font-weight:bold;height:30px;line-height:30px;text-align:center;}
  140. .tqyb_new {border-collapse: collapse;width:634px;}
  141. .tqyb_new td {background-color:#FFFFFF;border:1px solid #99B0DA;line-height:30px;height:30px;text-align:center;}
  142. .tqtb_pic{border-bottom:1px solid #99b0da;border-right:1px solid #99b0da;height:26px;text-align:center;width:69px;}
  143. .tqtb_pic img{padding-top:3px;}
  144. #bo2 ul.day a,#bo2 ul.day1 a{color:#C00;}
  145. #bo2 ul.content,#bo2 ul.content1,#bo2 ul.content2,#bo2 ul.content3,#bo2 ul.content4,#bo2 ul.content5,.tc{float:left;}
  146. #bo2 ul.content3 li em a,#bo2 ul.content3 li em{color:#000065;}
  147. #bo3{width: 660px;margin:10px auto 0px auto;clear:both;}
  148. #bo3 dl{width: 315px;float: left;margin: 10px 0 0 10px;display: inline;line-height: 1.8;background: #ebeff7;height: 110px;}
  149. #bo3 dt{width: 70px;float: left;margin: 15px 0 0 10px;}
  150. #bo3 dd{width: 210px;float: left;margin: 15px 0 0 15px;display: inline;}
  151. #bo3 dd em{color: #cc0000;}
  152. #bo3 dd i{color: #009900;}
  153. #bo4{width: 660px; margin:10px auto 1px auto;clear:both;text-align: center;line-height: 30px;}
  154. #bo5{width: 660px; margin:10px auto 1px auto;clear:both;text-align: left;line-height: 24px;}
  155. #footer{width:660px; margin:10px auto 1px auto;clear:both; text-align:center;}
  156. #footercontent{ padding:6px;border:1px solid #A5B5C0;background:#EBEEF6;}
  157. #footercopyrights{padding:6px;line-height: 20px;}
  158.  
  159. </style>
  160. <script language="JavaScript" src="./calendar.js" charset="gbk"></script>
  161. </head>
  162. <body>
  163. <div id="header">
  164.   <div id="topnav">
  165.     <ul>
  166.       <li style="background:none"><a href="http://www.zongyang8.com" target="_blank">枞阳网</a></li>
  167.       <li style="background:none"><a href="http://www.zongyang8.com/weather/" target="_blank">天气预报</a></li>
  168.       <li style="background:none"><a href="http://www.zongyang8.com/thread-46-1-1.html" target="_blank">便民电话</a></li>
  169.       <li style="background:none"><a href="http://www.zongyang8.com/thread-29-1-1.html" target="_blank">公交路线</a></li>
  170.       <li style="background:none"><a href="http://www.zongyang8.com/thread-27-1-1.html" target="_blank">枞阳QQ群</a></li>
  171.       <li style="background:none"><a href="http://www.zongyang8.com/thread-82-1-1.html" target="_blank">枞阳领导</a></li>
  172.       <li style="background:none"><a href="http://www.zongyang8.com/thread-81-1-1.html" target="_blank">枞阳乡镇</a></li>
  173.       <li style="background:none"><a href="http://www.zongyang8.com/thread-28-1-1.html" target="_blank">枞阳方言</a></li>
  174.       <li style="background:none"><a href="http://www.zongyang8.com/thread-2-1-1.html" target="_blank">枞阳县志</a></li>
  175.     </ul>
  176.   </div>
  177. </div>
  178. <?
  179.         require( "b.php" );
  180. ?>
  181. <div class="clear"></div>
  182. <div id="bo4">当天<?= $tqcity ?>天气调用:<input type="text" size=75 value="<script language='JavaScript' src='<?= $tqurl ?>/?a=today' charset='utf-8'></script>" /><br />以上天气数据由中央气象局提供</div>
  183. <div id="bo5">友情链接:<a href="http://www.zongyang8.com" target="_blank">枞阳网</a> <a href="http://www.weather.com.cn" target="_blank">中国天气</a> <a href="http://www.nmc.gov.cn" target="_blank">中央气象台</a></div>
  184. <div class="clear"></div>
  185. <div id="footer">
  186. <hr height="1" />
  187.   <div id="footercopyrights">
  188.     Copyright&nbsp;&copy;&nbsp;2012&nbsp;<?=$_SERVER['HTTP_HOST']?>&nbsp;Incorporated.&nbsp;All&nbsp;rights&nbsp;reserved<div style="display:none"><script src="http://s85.cnzz.com/stat.php?id=3324861&web_id=3324861" language="JavaScript"></script><script type="text/javascript">var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://");document.write(unescape("%3Cscript src='" + _bdhmProtocol + "hm.baidu.com/h.js%3F326cf833dbdc5a939995d145ef27dda7' type='text/javascript'%3E%3C/script%3E"));</script></div><br />
  189.   </div>
  190. </div>
  191.  
  192. </body>
  193. </html>
  194. <?
  195. }
  196. ?>
  197.  
downloadindex.php Source code - Download Weather forecast PHP application v2.0 CongYang net Source code
Related Source Codes/Software:
Outside the chain terminator 115 (the original radiance copyrighted music library) v1.7 - Outside chain terminator 115 formerly known as glo... 2016-10-17
littlephpcmsͼƬϵͳv1.0 - Littlephpcms image system is based on littlephpcms... 2016-10-16
V1.0 littlephpcms school network - Based on the littlephpcms secondary development of... 2016-10-16
Quick game website system KKSite v1.0.9 - KKSite is a system of independent, free game site,... 2016-10-16
The StatusNet open source microblogging v1.0.0 rc multilingual version - The StatusNet is a very old open source microblogg... 2016-10-16
Domain name LOGO created online program - Domain name LOGO created online program 2016-10-17
PHP talent net v0.1 DZ BBS (integration) - PHP talent net (can integrate DZ BBS) : PHP + MYSQ... 2016-10-17
The HP website advertising management plugin v2.0 - Web site advertising for some time, management wil... 2016-10-17
The IP address query and thunderbolt/express online conversion v0.1 - IP address query and thunderbolt/express online tr... 2016-10-17
Most partnership v8.0 the thief - Partnership won the thief is a free update mainten... 2016-10-17
ionic - Build amazing native and progressive web apps with... 2017-06-06
requests - Python HTTP Requests for Humans  ... 2017-06-06
vue2-elm - Based on vue2 + vuex to build a large single-page ... 2017-06-05
localstack - A fully functional local AWS cloud stack. Develop ... 2017-06-05
mithril.js - A Javascript Framework for Building Brilliant Appl... 2017-06-05
jquery-validation - jQuery Validation Plugin library sources ... 2017-06-05
react-sketchapp - render React components to Sketch 2017-06-05
yoga - Yoga is a cross-platform layout engine which imple... 2017-06-05
bash-guide - A guide to learn bash 2017-06-05

 Back to top