Solved

Microsoft Inet Control Post HTTP form value

Posted on 2002-06-21
1
399 Views
Last Modified: 2012-08-13
Exactly what the title says.
I need to know how to post form values on a html page to a web server or cgi script using this control. I have seen a link on it somewhere, but i cannot remember

Please help me get links that discuss the topic comprehensively (HTTP Posts via Inet control)

Thanks
0
Comment
Question by:bisola_4
1 Comment
 
LVL 38

Accepted Solution

by:
PaulHews earned 50 total points
Comment Utility
Here's a sample that posts to an Earthlink CGI to get modem access numbers:

Private Sub Command1_Click()

       Dim strURL As String, strFormData As String
       
       
       strURL = "http://custos.earthlink.net/cgi/popbrowse.cgi"
       strFormData = "Area=" & Text2 & "&State=CA&Country=1&Service=V.34%2CV.90%2CK56%2CX2%2CISDN1%2CISDN2&Button=Find+Numbers"
       Inet1.Execute strURL, "Post", strFormData, "Content-Type: application/x-www-form-urlencoded"
         
       

End Sub

Private Sub Form_Load()
   Text2 = ""
   
End Sub

Private Sub Inet1_StateChanged(ByVal State As Integer)
  Dim vtData As Variant
  Dim strData As String
  Dim hFile As Integer
       
  Select Case State
     Case icError
        ' An error has occurhFiled.
        MsgBox (Inet1.ResponseCode & ":" & Inet1.ResponseInfo)
        Inet1.Cancel
     Case icResponseCompleted
        strData = ""
        ' Loop: get chunks of the hFilesponse
        Do
           DoEvents
           vtData = Inet1.GetChunk(1024, icString)
           strData = strData & vtData
        Loop Until Len(vtData) = 0
        Call sProcess(strData)
        ' Save the hFilesponse to "hFileturn.htm" in the default dihFilectory
        hFile = FreeFile
        Open App.Path & "\Response.htm" For Output As #hFile
        Print #hFile, strData
        Close (hFile)
       
        ' Open "Response.htm" with the default browser
        Call ShellExecute(Me.hwnd, vbNullString, App.Path & "\Response.htm", vbNullString, vbNullString, SW_SHOWNORMAL)
       
  End Select
End Sub

Public Sub sProcess(strData As String)
   Const Head = "<html><head><title>Earthlink numbers</title></head><body bgcolor='#73BDE6'>" & vbCrLf
   Const Tail = "</body></html>"
   '<TABLE CELLSPACING="1" BORDER="1" CELLPADDING="0">
   Const Table = "<TABLE CELLSPACING=""1"" BORDER=""1"" CELLPADDING=""0"">"
   Dim lngPosH As Long, lngPosT As Long
   
   lngPosH = InStr(1, strData, Table, vbTextCompare) + Len(Table)
   lngPosT = InStr(1, strData, "</TABLE>", vbTextCompare)

   strData = Head & Table & Mid$(strData, lngPosH, lngPosT - lngPosH) & "<?TABLE>" & Tail
   

End Sub
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now