2

我对网络编程非常陌生。我正在尝试从 ASP.net 网站下载 excel。IT 不需要身份验证,但是我无法调试 URL,因为萤火虫不会像我一样请求 URL。高低搜索。对此的任何输入都会很棒。先感谢您。

网站:http ://tebb.elpaso.com/ebbmasterpage/Capacity/OperAvailAutoTable.aspx?code=TGP&name=Operationally%20Available%20Capacity&status=Cap&sParam2=M&sParam3=5/4/2012&sParam8=S

行动:我点击“摘要下载”按钮下载excel。

我不知道 onClick() 去哪里了。

4

2 回答 2

1

http://tebb.elpaso.com/ebbmasterpage/Capacity/OperAvailAutoTable.aspx?code=TGP&name=Operationally+Available+Capacity&status=Cap&sParam2=M&sParam3=5%2f4%2f2012&sParam8=S

Param3 代表日期,%2f 是 html 编码的 /

这里的关键是发布数据。要下载 excel 文件,原始帖子数据是:

__ EVENTTARGET=& _EVENTARGUMENT=&ctl00_WebSplitter1_tmpl0_NavigationUserControl1_TreeView1_ExpandState=ennunnnnnnnnunnnnnunnnnnnnunnnnnnnnnnnnnnnnnnnnnnnnnnnnnunnnnnnnnnnnnnnnnnnnnnnnnnunnnnnnnnnnnnnnnnnnnnnnnnn&ctl00_WebSplitter1_tmpl0_NavigationUserControl1_TreeView1_SelectedNode=&_ LASTFO_VIEWSTATE=%2FwEPDwUIOTA0MDgxNzEPFgYeCmhpZGVDb2x1bW4y3QEAAQAAAP%2F%2F%2F%4P2NvZGU9VEdQJm5hbWU9T3BlcmF0aW9uYWxseSBBdmFpbGFibGUgQ2FwYWNpdHkmc3RhdHVzPUNhcCZzUGFyYW0yPU0mc1BhcmFtMz01LzQvMjAxMiZzUGFyYW04PVNkZAIBDw8WBB8IGwAAAAAAADlABwAAAB8GAoACZBYCZg8PFgIeBFRleHQFEFN1bW1hcnkgRG93bmxvYWQWBB4Hb25jbGljawUKc2hvd0ltZygpOx4Gb25CbHVyBQpoaWRlSW1nKCk7ZAICDw8WBB8IGwAAAAAAQFBABwAAAB8GAoACZGQCAw9kFgJmDw8WAh8HZ2RkAgQPZBYCZg8QDx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3wuLi9pZ19yZXMvRWxlY3RyaWNCbHVlL2lnX3NoYXJlZC5jc3N8Li4vaWdfcmVzL0VsZWN0cmljQmx1ZS9pZ19ncmlkLmNzc2QYAQUeX19Db250cm9sc1JlcXVpcmVQb3N0QmFja0tleV9fFgMFEmN0bDAwJFdlYlNwbGl0dGVyMQU5Y3RsMDAkV2ViU3BsaXR0ZXIxJHRtcGwwJE5hdmlnYXRpb25Vc2VyQ29udHJvbDEkVHJlZVZpZXcxBTpjdGwwMCRXZWJTcGxpdHRlcjEkdG1wbDEkQ29udGVudFBsYWNlSG9sZGVyMSRVbHRyYVdlYkdyaWQxChBz9pI6%2BnL7w6b%2B8VpMMVQUpjRuWt1dkDI5QOKOHqk%3D&__PREVIOUSPAGE=__上一页=__上一页=q1Vu5vuap4CxPC3AZarvFeTSUmpu1Y5Qe6RAgsXMl-9eN-hzR45dQjqjC-HEjZ0&__EVENTVALIDATION=%2FwEWDwKF0M%2FIBQKWk6OhBAKx%2FMC2DgLM5d7LCALhg%2FaUDwKHxPzXAQKkobflCwKtsbmoAQLQ5oWgCgL73d1IAvSyi6UMAvayt6UMAvCyt6UMAoaSk6MKAqDJoG0zZk9itnjKzHvp455sJC0LF3pnU%2F9GwKhhL5KKketXYQ%3D%3D&ctl00_WebSplitter1_clientState=%7C0%7C216%2C2%2C1058%2C2%2C%7C%7C%5B%5B%5B%5Bnull%2Cnull%5D %5D%2C%5B%5D%2C%5B%7B%220%22%3A%5B%5Bnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2C2%2Cnull%2Cnull%2Cnull%2C%2217%25%22 %5D%5D%2C%221%22%3A%5B%5Bnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2C%2283%25%22%5D%5D%7D%5D %5D%2C%5B%7B%7D%2C%5B%7B%222%22%3A%5B%221%22%2C10%2C%221058px%22%5D%2C%223%22%3A%5B%220 %22%2C10%2C%22216px%22%5D%7D%5D%5D%2Cnull%5D&ctl00%24WebSplitter1%24tmpl1%24ContentPlaceHolder1%24sumBtnDownload=摘要+下载&ctl00%24WebSplitter1%24tmpl1%24ContentPlaceDLer1%24SumDownloadDctl00%24WebSplitter1%24tmpl1%24ContentPlaceHolder1%24PageSizeDDL=15&ctl00xWebSplitter1xtmpl1xContentPlaceHolder1xUltraWebGrid1=%253CDisplayLayout%253E%253CStateChanges%253E%253C%2FStateChanges%253E%253C%2FDisplayLayout%253E&ctl00%24_IG_CSS_LINKS_=MasterStyleSheet.css%7C..%2Fig_res%2FElectricBlue%2Fig_splitter.css %7C..%2Fig_res%2FElectricBlue%2Fig_shared.css%7C..%2Fig_res%2FElectricBlue%2Fig_grid.css

这是使用 HTTP Analyzer v6 发现的。我制作了一个 VB6 测试程序,我成功下载了 5/4/2012、5/3/2012 和 5/2/2012,只需更改 URL 中的 Param3,它使用 cURL,但您应该可以将其用作如何提交 http 请求以接收 excel 文件作为 http 响应的示例。LoadResString(101) 将上述发布数据加载到 CURLOPT_POSTFIELDS 中。等效地,可以将 LoadResString 替换为上述帖子数据的字符串文字。

Private Sub XPButton1_Click()
Dim CurlContext As Long
Dim buf As New StringBuffer

CurlContext = vbcurl_easy_init()

vbcurl_easy_setopt CurlContext, CURLOPT_URL, "http://tebb.elpaso.com/ebbmasterpage/Capacity/OperAvailAutoTable.aspx?code=TGP&name=Operationally+Available+Capacity&status=Cap&sParam2=M&sParam3=5%2f3%2f2012&sParam8=S"
vbcurl_easy_setopt CurlContext, CURLOPT_COOKIEJAR, App.Path & "\cookie.txt"
vbcurl_easy_setopt CurlContext, CURLOPT_COOKIEFILE, App.Path & "\cookie.txt"
vbcurl_easy_setopt CurlContext, CURLOPT_FOLLOWLOCATION, 1

vbcurl_easy_setopt CurlContext, CURLOPT_POST, 1
vbcurl_easy_setopt CurlContext, CURLOPT_POSTFIELDS, LoadResString(101)


vbcurl_easy_setopt CurlContext, CURLOPT_PROXYAUTH, CURLAUTH_ANY 'the next 5 lines are only needed to accommodate connecting through a proxy server
vbcurl_easy_setopt CurlContext, CURLOPT_HTTPPROXYTUNNEL, 0 
vbcurl_easy_setopt CurlContext, CURLOPT_PROXY, "your.proxy.if.any.com"
vbcurl_easy_setopt CurlContext, CURLOPT_PROXYPORT, 80 'or your proxy port
vbcurl_easy_setopt CurlContext, CURLOPT_PROXYUSERPWD, "" 
vbcurl_easy_setopt CurlContext, CURLOPT_WRITEDATA, ObjPtr(buf)
vbcurl_easy_setopt CurlContext, CURLOPT_WRITEFUNCTION, _
    AddressOf WriteFunction
vbcurl_easy_setopt CurlContext, CURLOPT_DEBUGFUNCTION, _
    AddressOf DebugFunction
vbcurl_easy_setopt CurlContext, CURLOPT_VERBOSE, True

ret = vbcurl_easy_perform(CurlContext)

Open App.Path & "\test.xls" For Output As #1
Print #1, buf.stringData
Close #1

End Sub

这是下载数据的直接方式,使用 Siddharth Rout 的路由可以适应网站的代码更改。关于“复杂部分”的最后一点。您需要做的就是使用 FindWindow 等待“文件下载”框出现,一旦您知道它已启动,您可以使用keybd_event发送 3 个选项卡和一个回车键,稍等片刻,再次按回车键和“y”如果您要覆盖文件。现在,直接下载的优点是您可以准确选择保存位置和方式。

如果您想了解更多关于我的方法的细节,我很乐意将代码发布到 StringBuffer、WriteFunction 和 DebugFunction 并解释如何从 vb 引用 libcurl。

更新,每个请求的附加代码: StringBuffer.cls

Private byteData() As Byte
Private stringLength As Long
Private arrayLength As Long


Private Sub Class_Initialize()

ReDim byteData(1024)
arrayLength = 1024
stringLength = 0

End Sub

Public Sub Class_Terminate()

Erase byteData

End Sub


Public Property Get stringData() As String

stringData = String(stringLength, " ")
CopyMemory ByVal stringData, byteData(0), stringLength

End Property

Public Property Let stringData(newStringdata As String)

Dim newStringLength As Long

newStringLength = Len(newStringdata)

If newStringLength > arrayLength Then
    arrayLength = (arrayLength + (newStringLength - newStringLength Mod 2)) * 2
    ReDim Preserve byteData(arrayLength)
End If


CopyMemory byteData(0), ByVal newStringdata, newStringLength

stringLength = newStringLength


End Property

Public Function quickConcat(newStringdata As String)

Dim newStringLength As Long

newStringLength = Len(newStringdata) + stringLength

If newStringLength > arrayLength Then
    arrayLength = (arrayLength + (newStringLength - newStringLength Mod 2)) * 2
    ReDim Preserve byteData(arrayLength)
End If

Dim amountToAdd
amountToAdd = newStringLength - stringLength

CopyMemory byteData(stringLength), ByVal newStringdata, amountToAdd

stringLength = newStringLength

End Function

写功能:

Public Function WriteFunction(ByVal rawBytes As Long, _
    ByVal sz As Long, ByVal nmemb As Long, _
    ByVal extra As Long) As Long

    Dim totalBytes As Long, i As Long
    Dim obj As Object, buf As StringBuffer
    Dim tempStr As String
    Dim Buffer() As Byte

    totalBytes = sz * nmemb

    Set obj = AsObject(extra)
    Set buf = obj
    ' append the binary characters to the HTML string
    If Not ((rawBytes = 0) Or (totalBytes = 0)) Then

        ReDim Buffer(0 To (totalBytes - 1)) As Byte
        CopyMemory Buffer(0), ByVal rawBytes, totalBytes

        tempStr = String(totalBytes, " ")
        CopyMemory ByVal tempStr, Buffer(0), totalBytes

        buf.quickConcat (tempStr)

    End If
    ' Need this line below since AsObject gets a stolen reference
    ObjectPtr(obj) = 0&

    ' Return value
    WriteFunction = totalBytes
End Function

调试功能:

Public Function DebugFunction(ByVal info As curl_infotype, _
    ByVal rawBytes As Long, ByVal numBytes As Long, _
    ByVal extra As Long) As Long
    Dim debugMsg As String
    Dim i As Long
    debugMsg = ""
    For i = 0 To numBytes - 1
        debugMsg = debugMsg & Chr(MemByte(rawBytes + i))
    Next
    Debug.Print "info=" & info & ", debugMsg=" & debugMsg
    DebugFunction = 0

    DoEvents

End Function

以下是在 vb6 中使用 curl 所需的 dll 和类型库: libcurl bindings for vb6

将上述文件解压到项目目录并转到项目->引用并添加两个 tlb 文件(类型库)。

此外,这里是 vb libcurl 绑定的 sourceforge 页面,下载包括源代码和几个示例:http: //sourceforge.net/projects/libcurl-vb/

于 2012-05-10T15:11:33.460 回答
1

你正在尝试的有点复杂。不是第一部分,而是第二部分。

逻辑

第 1 部分)单击“摘要下载”按钮以启动“文件下载”对话框

PART 2 ) 点击“文件下载”中的保存按钮,最终保存文件


第1部分

在表单上放置一个 WebBrowser1 控件和一个按钮。粘贴此代码。

Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
    WebBrowser1.Navigate("http://tebb.elpaso.com/ebbmasterpage/Capacity/OperAvailAutoTable.aspx?code=TGP&name=Operationally%20Available%20Capacity&status=Cap&sParam2=M&sParam3=5/4/2012&sParam8=S")
End Sub

Private Sub WebBrowser1_DocumentCompleted(sender As Object, e As  _
System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted

    If WebBrowser1.ReadyState <> 4 Then Exit Sub

    Dim el As HtmlElement = _
    WebBrowser1.Document.GetElementById("ctl00_WebSplitter1_tmpl1_ContentPlaceHolder1_sumBtnDownload")

    el.InvokeMember("Click")
End Sub

现在,当您运行此代码时,它将单击“摘要下载”按钮并启动“文件下载”对话框。请参阅下面的快照。


第 2 部分 - 复杂部分

现在您需要使用 API 来单击对话框上的Save按钮。File Download幸运的是,我已经在我的博客中介绍了这一点,所以你不会有任何问题 :)

主题:VBA/VB.Net/VB6——在IE下载窗口点击打开/保存/取消按钮——第一部分

链接http ://www.siddharthout.com/2011/10/23/vbavb-netvb6click-opensavecancel-button-on-ie-download-window/

快照

在此处输入图像描述

高温高压

于 2012-05-09T17:34:02.960 回答