以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  关于网站代码的问题请教  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=109886)

--  作者:ap9709130
--  发布时间:2017/11/22 11:04:00
--  关于网站代码的问题请教

各们老师

 

以下是这个网?的网址:http://125.35.6.80:8080/ftba/fw.jsp


--  作者:ap9709130
--  发布时间:2017/11/22 11:07:00
--  

关于这个网站,下面那个第一页,和最后一页的代码是这样的:

<a href="#" title="1" id="pageIto_first">首页</a>

<a href="#" title="2" id="pageIto_first2" style="padding:4px;">2</a>

<a href="#" title="2" id="pageIto_next">下一页</a>

 

理论上来说,后台应该是接受到一个值,就是相关的页数,然后服务器就把相关的页的数据发送过来.如何才能实现这个网站一样,只能7页呢?  如果我想直接到70页,能实现吗?


--  作者:有点甜
--  发布时间:2017/11/22 12:14:00
--  

mark 模拟请求

 

Dim body As String = "on=true&page=5&pageSize=15&productName=&conditionType=1&applyname=&applysn="
Dim req = System.Net.WebRequest.Create("http://125.35.6.80:8080/ftba/itownet/fwAction.do?method=getBaNewInfoPage")
req.Method = "POST"
req.ContentType = "application/x-www-form-urlencoded"
req.UserAgent = "Mozilla/5.0 (Windows NT 6.3; rv:57.0) Gecko/20100101 Firefox/57.0"
Dim aryBuf As Byte() = Encoding.UTF8.GetBytes(body)
req.ContentLength = aryBuf.Length
Dim writer = req.GetRequestStream()
writer.Write(aryBuf, 0, aryBuf.Length)
writer.Close()
writer.Dispose()
Dim pos = req.GetResponse

Dim stm As System.IO.Stream = pos.GetResponseStream()
Dim reader As New System.IO.StreamReader(stm)
Dim str As String = reader.ReadToEnd
pos.Close
stm.Close
reader.close

msgbox(str)
Dim jo As JObject = Jobject.Parse(str)
msgbox(jo.ToString)
For Each o As JObject In jo("list")
    output.show(o.tostring)
    output.show(o("applySn"))
next


--  作者:ap9709130
--  发布时间:2017/11/22 14:20:00
--  

老师,好强大啊.

哪里有这方面的资料呢?

 

还有,原来网站里,备案编号和产品名称里面有链接,要怎么用模拟请求 去实现?


--  作者:有点甜
--  发布时间:2017/11/22 15:56:00
--  

1、连接是根据id值得到的,id值在你的数据里面,如

 

http://125.35.6.80:8080/ftba/itownet/hzp_ba/fw/pz.jsp?processid=201710311023423jvoh

 

2、如果想学基础,可以买一本vb.net或者c#的书籍来学习。


--  作者:ap9709130
--  发布时间:2017/11/22 16:03:00
--  
有点甜老师

这个我也发现了.但是我不知道模拟的方法是get 还是 Post, 然后代码试了一下,写过不了,我会努去学习的.

代码能帮我写一次吗?你写了一次,我基本就都会弄了.


就是基于这个网址写一下模拟请求,多谢!


--  作者:有点甜
--  发布时间:2017/11/22 16:12:00
--  

使用浏览器的调试功能(F12),查找得到访问的地址

 

Dim body As String = "processid=201710311023423jvoh"
Dim req = System.Net.WebRequest.Create("http://125.35.6.80:8080/ftba/itownet/fwAction.do?method=getBaInfo")
req.Method = "POST"
req.ContentType = "application/x-www-form-urlencoded"
req.UserAgent = "Mozilla/5.0 (Windows NT 6.3; rv:57.0) Gecko/20100101 Firefox/57.0"
Dim aryBuf As Byte() = Encoding.UTF8.GetBytes(body)
req.ContentLength = aryBuf.Length
Dim writer = req.GetRequestStream()
writer.Write(aryBuf, 0, aryBuf.Length)
writer.Close()
writer.Dispose()
Dim pos = req.GetResponse

Dim stm As System.IO.Stream = pos.GetResponseStream()
Dim reader As New System.IO.StreamReader(stm)
Dim str As String = reader.ReadToEnd
pos.Close
stm.Close
reader.close

msgbox(str)
Dim jo As JObject = Jobject.Parse(str)
msgbox(jo.ToString)


--  作者:ap9709130
--  发布时间:2017/11/24 15:03:00
--  
有点甜老师

还有个问题搞不清楚:网址:http://125.35.6.80:8080/ftba/itownet/hzp_ba/fw/pz.jsp?processid=20140612144640ouc8z&nid=20140612144640ouc8z

其中的备案日期:htm码如下: <h6>备案日期 &nbsp;2014-06-18 </h6>

后台查询的数据出来里面没有这个备案日期.
怎么才能把这个备案日期弄出来.数据里都没有.


--  作者:有点甜
--  发布时间:2017/11/24 15:12:00
--  

Dim body As String = "processid=20140612144640ouc8z"
Dim req = System.Net.WebRequest.Create("http://125.35.6.80:8080/ftba/itownet/fwAction.do?method=getBaInfo")
req.Method = "POST"
req.ContentType = "application/x-www-form-urlencoded"
req.UserAgent = "Mozilla/5.0 (Windows NT 6.3; rv:57.0) Gecko/20100101 Firefox/57.0"
Dim aryBuf As Byte() = Encoding.UTF8.GetBytes(body)
req.ContentLength = aryBuf.Length
Dim writer = req.GetRequestStream()
writer.Write(aryBuf, 0, aryBuf.Length)
writer.Close()
writer.Dispose()
Dim pos = req.GetResponse

Dim stm As System.IO.Stream = pos.GetResponseStream()
Dim reader As New System.IO.StreamReader(stm)
Dim str As String = reader.ReadToEnd
pos.Close
stm.Close
reader.close

Dim jo As JObject = Jobject.Parse(str)
output.show(jo.ToString)
msgbox(jo("provinceConfirm"))


--  作者:ap9709130
--  发布时间:2017/11/28 10:01:00
--  
有点甜老师

  用这个方法返来的的数量:Dim jo As JObject = Jobject.Parse(str)
                                       output.show(jo.ToString)
     如果判断jo 里是否有 "provinceConfirm" ?
    因为有时候返回的数据没有的,就会出错.