vb post data to web site

Posted on 2006-06-24
Last Modified: 2008-01-09
I am using VB Express 2005 and would like ideas of how to automatically post data to a website.
I want to create an application which will periodically send it's results to a public web server over https so that it can be analysed. VB Express 2005 includes a Web Browser control if this helps.
My intention is to use the VB app to compress a file of results and then post that file to an appropriate server.
Any ideas?
Question by:john_123
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
  • 2
LVL 35

Expert Comment

by:[ fanpages ]
ID: 16977982

Speak to the owner of the server & ask how they can receive your file, or the contents of your file.

You may be able to post the entire file using a HTTP:// request, or you may need to stream the contents line by line (or character by character) to a pre-built data channel.




Author Comment

ID: 16978943
We are the owner of the server.
We need to periodically transfer an amount of statistical data to a web server for analysis.
Rather than writing a client/server to transfer data I thought it would be appopriate to simply post the data to the web server. This way I can also use HTTPS to encrypt it later.

I have gone down this path so far
Dim xmlhttp As Object
xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")
xmlhttp.Open("POST", "", False)
xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
xmlhttp = Nothing

This only seems to allow me to send data separated by the & sign as part of the URL - I would like to use this to be able to submit a file.

Is there any better way to achieve this?

Author Comment

ID: 16979853
I think I have achieved my goal through the following...

  Dim strText As String, strBody As String
        Dim strFilename As String
        strFilename = "c:\results.txt"

        Microsoft.VisualBasic.FileOpen(1, strFilename, OpenMode.Binary, OpenAccess.Read)
        strText = New String(" ", LOF(1))
        Microsoft.VisualBasic.FileGet(1, strText)

        Dim xmlhttp As Object
        xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")
        xmlhttp.Open("POST", "", False)
        xmlhttp.setRequestHeader("Content-Type", "multipart/form-data, boundary=AaB03x")
        strBody = _
           "--AaB03x" & vbCrLf & _
           "Content-Disposition: form-data; name=""probe_id""" & vbCrLf & vbCrLf & _
           "12345" & vbCrLf & _
           "--AaB03x" & vbCrLf & _
           "Content-Disposition: attachment; name=""FILE1""; filename=""" & strFilename & """" & vbCrLf & _
           "Content-Type: text/plain" & vbCrLf & vbCrLf & _
           strText & vbCrLf & _
        xmlhttp = Nothing

Accepted Solution

Netminder earned 0 total points
ID: 17164456
Closed, 500 points refunded.
Site Admin

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Determine Range to Select 5 62
Excel VBA, find a string in a column, update a cell 7 115
using web browser with BING 40 146
VBA: loop recent folder and copy txt file. 8 56
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

739 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