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.Attachment 90481
GET request example:
POST request example:
POST request with multipart example:
---------------------------------
I hope you enjoy it. :) Sorry for my bad english.
Attachment 90481
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.Attachment 90481
GET request example:
Code:
Dim ansv As String
ansv = GetDataFromURL("http://vbforums.com")
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.
Attachment 90481