Download Code from an Internet Page....

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • tranky

    Download Code from an Internet Page....

    Hi, i'm italian...excus e me for my bad english.
    I've a problem.
    I need to download the code of a web page, but the translation of many
    character is invalid.
    An example is "à" wich is translate in "?", ecc...., or is become a square!!
    I need to import it from the web page but in the right character!
    I work connected to internet and with access 2003.
    The code i've used is the follow:

    Dim oHttp As Object
    Dim txtRequestStrin g, stringa2 As String
    Set oHttp = CreateObject("M SXML2.XMLHTTP")
    txtRequestStrin g = www
    oHttp.Open "GET", txtRequestStrin g, False
    oHttp.Send
    txtHTML = oHttp.responset ext

    in txtHTML i've the code downloaded from the page but it is made of pipe
    (||||) or ?? or square. I need, instead, that the code was downloading
    normally.

    Excuse me for the english....in Italy, english's teachers are very bad....
    :)

    thank you

    ps: (i can also change object to use if you find a different solution)


  • Lyle Fairfield

    #2
    Re: Download Code from an Internet Page....

    This works for me. That is, it downloads all the files in the server
    folder to my local computer.
    It also, (would be removed if not needed), produces a text/ascii
    manifestation of the files, and for want of something better to do,
    prints that in the immediate window. The text and ascii attributes can
    be changed.

    Conditions are (mostly a guess) that your server is all MS, that you
    have the latest MDAC installed and, of course, that you have access to
    the site (username and password). If you try running this code per se I
    STRONGLY HOPE it will fail as you will be prompted for a user name and
    password.

    As always, ... news clients may insert line feeds which will create
    syntax errors.

    Option Explicit

    Public Sub GetRemoteFiles( _
    ByVal url As String, _
    ByVal destination As String)

    Dim c As ADODB.Connectio n
    Dim r As ADODB.Record
    Dim rr As ADODB.Record
    Dim rs As ADODB.Recordset
    Dim s As ADODB.Stream
    Set c = New ADODB.Connectio n
    Set r = New ADODB.Record
    Set rr = New ADODB.Record
    Set s = New ADODB.Stream

    url = "url=" & url
    c.Open url

    r.ActiveConnect ion = c
    r.Open
    rr.ActiveConnec tion = c
    Set rs = r.GetChildren
    With rs
    Do While Not .EOF
    r.CopyRecord rs.Fields(0).Va lue, destination &
    rs.Fields(0).Va lue
    rr.Open rs.Fields(0).Va lue
    With s
    .Open rr, adModeRead, adOpenStreamFro mRecord
    .Charset = "ascii"
    .Type = adTypeText
    Debug.Print .ReadText
    .Close
    End With
    rr.Close
    .MoveNext
    Loop
    End With
    r.Close
    c.Close
    End Sub

    Sub TestGetRemoteFi les()
    GetRemoteFiles "http://www.ffdba.com/downloads/", "c:/temp/"
    End Sub

    tranky wrote:[color=blue]
    > Hi, i'm italian...excus e me for my bad english.
    > I've a problem.
    > I need to download the code of a web page, but the translation of many
    > character is invalid.
    > An example is "à" wich is translate in "?", ecc...., or is become a square!!
    > I need to import it from the web page but in the right character!
    > I work connected to internet and with access 2003.
    > The code i've used is the follow:
    >
    > Dim oHttp As Object
    > Dim txtRequestStrin g, stringa2 As String
    > Set oHttp = CreateObject("M SXML2.XMLHTTP")
    > txtRequestStrin g = www
    > oHttp.Open "GET", txtRequestStrin g, False
    > oHttp.Send
    > txtHTML = oHttp.responset ext
    >
    > in txtHTML i've the code downloaded from the page but it is made of pipe
    > (||||) or ?? or square. I need, instead, that the code was downloading
    > normally.
    >
    > Excuse me for the english....in Italy, english's teachers are very bad....
    > :)
    >
    > thank you
    >
    > ps: (i can also change object to use if you find a different solution)
    >
    >[/color]

    Comment

    Working...