Results 1 to 1 of 1

Thread: [vb6] Module: GetDataFromURL

  1. #1

    Thread Starter
    New Member AntiMaster's Avatar
    Join Date
    Aug 2012
    Location
    Belarus, Minsk.
    Posts
    1

    [vb6] Module: GetDataFromURL

    Originally, i writed this module for self. Now i'm publish module for others.

    This module created for the send GET\POST queries to the server.

    GetDataFromUrl: - Sending request to remote server.
    strURL - URL of the target page.
    Optional strMethod = GET - Page request method: GET, POST or Multipart. (POST with multipart)
    Optional Async = false - Run in asynchronous mod. (To prevent gui lags).
    Optional strPostData = "" - Data to post. (Only if strMethod = POST\Multipart)
    Optional boundary = "" - Boundary for multipart. (Only if strMethod = Multipart. Create with Make_Boundary.)

    Make_Boundary: - Making Boundary for POST + multipart request.

    Add_Multipart: - Adding fields for POST + multipart request.
    post_field - Field.
    post_data - Value of field. Leave empty, if you sending a file.
    boundary - Boundary. (Create with Make_Boundary.)
    Optional file_path = "" - Path to file. Leave empty, if you want to send post_data.mod_GetDataFromURL.bas


    GET request example:
    Code:
    Dim ansv As String
    ansv = GetDataFromURL("http://vbforums.com")
    POST request example:
    Code:
    Dim ansv As String
    ansv = GetDataFromURL("http://vbforums.com", "POST", false, "field1=value1&field2=value2")

    POST request with multipart example:
    Code:
    Dim ansv As String
    Dim Multipart As String
    Dim Boundary As String
    
    Boundary = Make_Boundary
    
    Multipart = Add_Multipart("Field1", "Value1", Boundary)
    Multipart = Multipart & Add_Multipart("Field2", "Value2", Boundary)
    Multipart = Multipart & Add_Multipart("File2", VbNullString, Boundary, "C:\test.txt") 'File upload example
    Multipart = Multipart & "--" & Boundary & "--"
    
    
    ansv = GetDataFromURL("http://vbforums.com", "Multipart", false, Multipart, Boundary)
    ---------------------------------
    I hope you enjoy it. Sorry for my bad english.

    mod_GetDataFromURL.bas
    Last edited by AntiMaster; Aug 14th, 2012 at 01:32 PM.

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