C# 微信 生活助手 空气质量 天气预报等 效果展示 数据抓取 (二)
第一次在博客园写博客写的不好,大家见谅。最近工作辞了,然后感冒发烧输了一个星期的液,感觉很烦躁,心情不是很好,在帝都感觉压力大,废话不说了开始正题把!
还没有完全完成,后续考虑开源!
可以关注微信公众帐号体验一下先看下 效果把
先介绍下工具 我用的有 httpwatch,fiddler
国家环保部的数据链接 http://datacenter.mep.gov.cn/report/air_daily/airDairyCityHour.jsp
原以为直接get请求就可以了 试了下 发现没有获取了 然后看了下代码 发现
<script type="text/javascript">
function submitForm(){
document.citydayform.submit();
}
</script>
<form name="citydayform" action="http://datacenter.mep.gov.cn:80/report/air_daily/airDairyCityHour.jsp" method="post" style="margin: 0px auto 0px auto;" onsubmit="return checkForm1();"> <table width="95%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolorlight="#d9d7b2" bordercolordark="#ffffff" class="font"> <tr> <td width="5%" height="30" bgcolor="#FFFFEF" align="right" class="STYLE1"> 城市: </td> <td width="8%" bgcolor="#FFFFFF"> <input type="text" name='city' value="" /> </td> <td width="5%" height="30" bgcolor="#FFFFEF" align="right" class="STYLE1 STYLE1"> 时间: </td> <td width="30%" bgcolor="#FFFFFF"> 从: <input type="text" id="startdate" name="startdate" readonly="true" onfocus="WdatePicker({ el: this.id, dateFmt: 'yyyy-MM-dd HH:mm', skin: 'whyGreen',maxDate:'#F{$dp.$D(\'enddate\')}' })" style="text-align: center;cursor: pointer;width: 160px;height: 21px;margin-top:0px;" class="Wdate" value="2015-04-16 22:00" /> 到: <input type="text" id="enddate" name="enddate" readonly="true" onfocus="WdatePicker({ el: this.id, dateFmt: 'yyyy-MM-dd HH:mm', skin: 'whyGreen',minDate:'#F{$dp.$D(\'startdate\')}' })" style="text-align: center;cursor: pointer;width: 160px;height: 21px;margin-top:0px;" class="Wdate" value="2015-04-16 22:00" /> </td> <td width="8%" bgcolor="#FFFFFF"> <div align="center"> <input type="image" src="/report/main/images/search.gif" width="83" height="19" /> </div> </td> </tr> </table> </form>