matlab抓取网页信息,批量抓取网页信息

Sub 按钮1_Click()

Dim url, html

n = 1

url = "http://www.zjcredit.gov.cn:8000/ListQuery.aspx"

For j = 1 To 5    '这里控制查询的页数

pd = "sectionID=02" _

& "&sortField=CreditID" _

& "&sortDirection=1" _

& "&recordTotal=3151" _

& "&pageNo=" & j _

& "&pageLength=20" _

& "&isOpen=False&isIntermediary=False" _

& "&query_AreaCode=" _

& "&query_OrganizationCode=" _

& "&query_BusinessLicense=" _

& "&query_CorporationName=" _

& "&query_LegalRepresentative=" _

& "&query_BusinessScope=" _

& "&query_PromptSymbol=D"

pd1 = "query_AreaCode=&query_OrganizationCode=&query_BusinessLicense=&query_CorporationName=&query_LegalRepresentative=&query_BusinessScope=&query_PromptSymbol=d&queryTitle=&businessLicense=&actionType=&searchType=&sectionID=02&hot=&returnFunction=parent.reset_queryTitles&query2_AreaCode=0&query2_BusinessLicense=&query2_CorporationName=&query2_OrganizationCode=&query2_LegalRepresentative=&validateTextbox="

Set html = CreateObject("htmlfile")

With CreateObject("msxml2.xmlhttp.6.0")

.Open "post", url, False

.setrequestheader "Content-Type", "application/x-www-form-urlencoded"

.send (pd)

html.body.innerhtml = .responsetext

Set tr = html.all.tags("tr")

For i = 0 To tr.Length - 1

If tr(i).bgcolor = "#ffffff" Or tr(i).bgcolor = "#f3f3f3" Then

n = n + 1

Cells(n, 1) = tr(i).ChildNodes(0).innertext

Cells(n, 2) = tr(i).ChildNodes(1).innertext

End If

Next

End With

Next

End Sub

Sub 按钮2_Click()

Range("a2:b65536").ClearContents

End Sub

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值