Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Intet Control HTTP POST

Posted on 2002-06-03
5
Medium Priority
?
307 Views
Last Modified: 2010-05-02
Can someone give me some code to http POST to a PHP script? Using VB6

I can get examples to work using the OpenURL method but not the Execute Post method.

Regards,
John
0
Comment
Question by:MAVERICK
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 53

Expert Comment

by:Ryan Chong
ID: 7050553
Try using WebBrowser Control?
0
 
LVL 1

Author Comment

by:MAVERICK
ID: 7050650
I dont need a web browser.. just the POST & Response

Regards,
John

0
 
LVL 38

Accepted Solution

by:
PaulHews earned 400 total points
ID: 7051313
Here's a sample that posts data to a cgi.

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
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 7054327
interesting...
0
 
LVL 1

Author Comment

by:MAVERICK
ID: 7083783
I tried out the example.. and it worked as expected & Solved the problem

Thanks
Maverick
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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…
Suggested Courses

636 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