Results 1 to 3 of 3

Thread: Very quick and simple question with inet

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Dec 2000
    Posts
    1,195
    I use the following code to get the size of a website (if theres a better way, please plst below )

    Code:
    Public Function CheckURL(strURL As String, LastModified As String) As Boolean
    
    Dim sBuffer         As String * 1024
    Dim lBufferLength   As Long
    Dim strObject       As String
    '
    'connect to the server on HTTP port
    '
    m_lInternetConnect = InternetConnect(p_lInternetSession, strURL, _
                                         INTERNET_DEFAULT_HTTP_PORT, _
                                         vbNullString, vbNullString, _
                                         INTERNET_SERVICE_HTTP, 0, 0)
    '
    'prepare HTTP request. We may use "HEAD" command to retrieve
    'only response headers, not document itself.
    '
    m_lHttpRequest = HttpOpenRequest(m_lInternetConnect, "HEAD", _
                                     strObject, "HTTP/1.0", vbNullString, 0, _
                                     INTERNET_FLAG_RELOAD, 0)
    If CBool(m_lHttpRequest) Then
        '
        'prepare string buffer to get server response
        '
        lBufferLength = Len(sBuffer)
        '
        'send request to remote server. On this state we need Interent connection.
        'If system not connected to Internet, dialog with default RAS entry will
        'be showed
        '
        iRetVal = HttpSendRequest(m_lHttpRequest, vbNullString, 0, 0, 0)
        '
        'header of the server response. If server has returned content length header
        'value of CheckURL will be True and sBuffer will consist value of the header
        '     
        CheckURL = CBool(HttpQueryInfo(m_lHttpRequest, HTTP_QUERY_CONTENT_LENGTH, _
                                      ByVal sBuffer, lBufferLength, 0))
                                     
        MsgBox CheckURL
    End if
    If i want to get the size of the file, i use msgbox getsize. However, I only get a response "True"... how can i get the size of the file (without downloading it) and display it in bytes, instead of "True"?
    Last edited by qpabani; Apr 8th, 2001 at 04:53 PM.

  2. #2
    Addicted Member dmr's Avatar
    Join Date
    Jul 2000
    Location
    West-Germany :) Timezone: GMT +1 [DST] North.......: 52° 16’ 09” East...: 10° 31’ 16”
    Posts
    255
    You've declared CheckURL serveral times as Boolean so it could only return true or false...

    Which references did you create?
    (I can't execute it... )
    Code that I author is neither elegant nor efficient. It is, however, functional. Once I get something that works, I'm generally satisfied with myself - I mean, if it works, that's good enough, right?

    Originally posted by aknisely
    Sorry, but I feel uncomfortable on CC with clothes on
    __________________
    The truth ... is out there!

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Dec 2000
    Posts
    1,195
    sorry.. foolish error its supposed to be msgbox sbuffer. then it works

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width