banner



How Download A File With Createobject([msxml2.xmlhttp]) In C#

  1. #i

    inosent is offline

    Thread Starter

    Hyperactive Member


    Download files using MSXML2.XMLHTTP

    i am having a little trouble downloading a file using MSXML2.XMLHTTP

    the code beneath works great *if* y'all can get a link that leads direct to the file, as in the example below

    Private Sub test()
    Dim objHTTP As Object
    Set objHTTP = CreateObject("MSXML2.XMLHTTP")
    Dim stl Every bit String
    Dim rt

    stl = "http://slmap.hostingweb.united states/examination/i.zip"
    objHTTP.Open up "Get", stl, False, "exam", "test" 'unme/pwd

    objHTTP.transport
    rt = objHTTP.responseBody

    Dim oADOStream
    Gear up oADOStream = CreateObject("ADODB.Stream")
    oADOStream.Type = 1
    oADOStream.Fashion = iii
    oADOStream.Open
    oADOStream.Write rt
    oADOStream.SaveToFile "c:\anyfilename.nil"
    oADOStream.Close
    Set oADOStream = Nada

    Set objHTTP = Nothing
    Finish Sub

    unfortunately it 'freezes' when trying to pull a file from a dissimilar sort of link, something like:

    http://anysite.com/231/en-usa/abc/gog...iii&saveas=1.zip

    i think it freezes because the link wants to open up a dialogue box or something. i have tried to retool the link, or find some other 1 that is direct continued to the file, only on some of these monster servers with the way they bargain with uploads and downloads the best i can do is the link i merely showed.

    has anybody had any experience with this?

    using a webbrowser you can navigate to the link, only the webbrowser is generlaly much slower so i want to become the MSXML2.XMLHTTP road if possible. it has been working great for simply virtually everything, but i ran into this snag and need some help.


  2. #2

    raman_xs is offline

    Inferior Member


    Re: Download files using MSXML2.XMLHTTP

    I've tried this code.

    Even if it is a normal downloading link, the zip file it saves on the disk is a currupted zip file and I cannot open up it.

    Regards,
    Raman


  3. #three

    inosent is offline

    Thread Starter

    Hyperactive Member


    Re: Download files using MSXML2.XMLHTTP

    non sure what happened on your end, might have been that the server was down at the time (a complimentary site which is a trivial prone to be downward), simply i just ran it once again and it works perfectly. only it does not work if the link is of, for the lack of a better term, an indirect nature, which is why i posted to meet if anyone has any thoughts on this.

    Quote Originally Posted by raman_xs

    I've tried this code.

    Even if information technology is a normal downloading link, the zip file it saves on the disk is a currupted aught file and I cannot open it.

    Regards,
    Raman


Source: https://www.vbforums.com/showthread.php?459294-Download-files-using-MSXML2-XMLHTTP

Posted by: sextonromenhaving.blogspot.com

0 Response to "How Download A File With Createobject([msxml2.xmlhttp]) In C#"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel