El titulo lo dice todo... Tampoco requiera add, solo un .bas...

Código: Seleccionar todo

Option Explicit
Public Declare Function InternetOpen Lib "wininet.dll" Alias "InternetOpenA" (ByVal sAgent As String, ByVal lAccessType As Long, ByVal sProxyName As String, ByVal sProxyBypass As String, ByVal lFlags As Long) As Long
Public Declare Function InternetOpenUrl Lib "wininet.dll" Alias "InternetOpenUrlA" (ByVal hInternetSession As Long, ByVal sURL As String, ByVal sHeaders As String, ByVal lHeadersLength As Long, ByVal lFlags As Long, ByVal lContext As Long) As Long
Public Declare Function InternetReadFile Lib "wininet.dll" (ByVal hFile As Long, ByVal sBuffer As String, ByVal lNumBytesToRead As Long, lNumberOfBytesRead As Long) As Integer
Public Declare Function InternetCloseHandle Lib "wininet.dll" (ByVal hInet As Long) As Integer

Public Const IF_FROM_CACHE = &H1000000
Public Const IF_MAKE_PERSISTENT = &H2000000
Public Const IF_NO_CACHE_WRITE = &H4000000
     
Private Const BUFFER_LEN = 256


Public Function GetUrlSource(sURL As String) As String
    Dim sBuffer As String * BUFFER_LEN, iResult As Integer, sData As String
    Dim hInternet As Long, hSession As Long, lReturn As Long
    hSession = InternetOpen("vb wininet", 1, vbNullString, vbNullString, 0)
    If hSession Then hInternet = InternetOpenUrl(hSession, sURL, vbNullString, 0, IF_NO_CACHE_WRITE, 0)
    If hInternet Then
        iResult = InternetReadFile(hInternet, sBuffer, BUFFER_LEN, lReturn)
        sData = sBuffer
        Do While lReturn <> 0
            iResult = InternetReadFile(hInternet, sBuffer, BUFFER_LEN, lReturn)
            sData = sData + Mid(sBuffer, 1, lReturn)
        Loop
    End If


    iResult = InternetCloseHandle(hInternet)

    GetUrlSource = sData
End Function
Enjoy!
¡Atención! LuisN2.com ha caido, pero el blog sigue estando en www.luisn2indetectables.blogspot.com o www.LuisN2.cz.cc
Jijiji
Puedes hacer como un downloader.
Es más, creo que puedes adaptar el código para hacer un downloader, runtime
Jejejeje

Así me gusta!
Pero no se si se baja los source enteros, podrías hacer un bucle, pero tienes que saber como funciona el protocolo Http.

Saludos!
github.com/Slek-Z
Si amigo, es como el ineto, pero como sabras el inet no baja el src entero, este si baja el src entero... y llevas razón! Downloader runtime! Me lo pido jaja!
¡Atención! LuisN2.com ha caido, pero el blog sigue estando en www.luisn2indetectables.blogspot.com o www.LuisN2.cz.cc
Responder

Volver a “Otros lenguajes”