Link to home
Start Free TrialLog in
Avatar of 0billyk0
0billyk0

asked on

How to send a few lines of text over the 'net to our server?

I wrote a small vb6 application which accepts a few snippets of data into a text window from a (GoldMine) database on remote servers. (A trigger in goldmine dde's this data to my app). These servers may be anywhere in the US and NOT on our network. I now want the contents of this txtBox.text window (just a small string or two) to be sent automatically to my web server over the internet. What is this process called and what is the code? I've searched and searched, I hope someone can help. My boss is waiting (sort of) patiently.
I'm pleased to be a member of this site. I'm far from expert, but maybe someday.........
Avatar of cheekycj
cheekycj
Flag of United States of America image

you could make your vb6 program either send the data over https to a server where it listens to a specific port and reads in the data as it comes in.

Or have your vb6 program ftp the data as a file to your server using an account.

What do you want the webserver to do with the data?

CJ
Avatar of 0billyk0
0billyk0

ASKER

We would indeed like to send the data over https to our web server just like you said, but no one here in our small company knows the code to do this. I am responsible for the creation/implementation of the app, and I sure don't know! Then once the data arrives at the web server, it will be transferred to our SQL Server database(another machine) and also to another remote site over the internet as an alert. (If I get this thing working, I'll get to keep my job!) Thanks in advance for any help, CJ or whomever!
Bill
i am not too sure about your problem, but i have two suggestion..

1. This is JSP section, why are you posting a VB problem in this section. More appropriate section would have been the ASP one.

2. now that you have posted it here.. here is what i think should solve your problem :

a. create an instance of Internet explorer in your app.
b. create an ASP page on the remote server where you want to post the data which will be an action page, taking the posted data to it, and will insert the data into the sql server dataabse as well as call the alert page on the other remote sever you mentioned.
c. Now in your vbapp, using that instance of IE, post that data to your asp page.

I think this should solve your problem. If not then tell me and i will try to get some sample code for you.
You will have to use APIs or FTP accounts.

If you want to use https.  Setup an API.

Your VB program will call this API using HTTPs:

https://yoursite.com/api/apiname

Now you will feed into this api login credentials and then data to insert.

The api will verify login credentials and then load the data into SQL Server using insert statements.

Then once the inserts are successful.  Send the alert to the other remote server.

Make sure everything is over https.

vb should be able to send an https call.  I don't think you need to use IE.

What language do you prefer to use ASP, JSP, ColdFusion or what?  I agree that since you know VB ASP maybe the easier route.

CJ
P.S. I've moved this thread over to the VB Section where it belongs! I've burned 200 points!
you can ask Community Support to PAQ this question for you so you don't have to use pts for this.  Unless you feel generous and want to award the pts to an expert who participated here.

CJ
Well, CJ, it's like this: I'm happy to award points to get my butt outta this jam! Completion of the overall project means a lot to our company, and this is the one thing keeping it un-completed.
what is you server setup?

r u able to run ASP or is your server running unix etc?
Able to run ASP. I will try to simplify: On another computer somewhere in the US is a little VB application (myLilApp.exe) that has txtBox.text = "John Doe, 1234 Main, TwilightZone, USA"
I'm searching for the code to grab that text and HTTP it to:
"123.234.123.123/myASPage.asp" The SendString() function that contains that code will be called by form_load() right after the string is put into the textbox.
is it only 1 line at a time or multiple lines?

CJ
It will be maybe two lines or three in a textbox with a verical scroll bar but could be made into one line with a horizontal. It's literally "Name, address, Accountno, StatusCode" Are we zero-ing in?
are you going to send this over as a file.. or post it to a cgi?

CJ
Um... We're posting it to an ASP script, not a perl script.
CGI is a generic term.  a cgi can be written in ASP, Perl, C, VB, Java, php, etc.

This should show you how to do an http post via VB:

http://abstractvb.com/code.asp?A=948

I am not sure if it will work for https too.. but try it.

For the ASP script..

That is simple.. use
Request.QueryString("varname"); to get it.

To insert into the DB use:
<%
Set Conn = Server.CreateObject("ADODB.Connection")
sql = "DRIVER={Microsoft Access Driver (*.mdb)};"
sql = sql & "DBQ=" & Server.MapPath("thuttonnet.mdb") & ";"
Conn.Open(sql)
sql = "INSERT INTO yourtable(Name,Address,Accountno,StatusCode) Values" & _
"('" & Request("Name")) & "', '" & Request("Address") & "', " & Request("Accountno") & ", " & Request("StatusCode") & ")"
Conn.Execute(sql)
%>

Now this shows how to do it for 1 record.  You would have to play with the code to insert multiple records.. but this should get you started.

CJ
Luv ya cj: i'll try this tomorrow, Sunday, or Monday at work.
At this point when I look at the code, I'm not sure how the VB compiler is going to handle the <%%> tags. I have a  hunch they'll be rejected the moment I try to compile the thing. Remember, this is code within a vb6 form_load() function.
One more thing: for you experienced folks on this site, I have some pretty useful skills myself; win 32 api calls from vb, etc, how can I be of value to the site?
the <%... %> code is for ASP. so it will be run on the server.

If you know Win 32 API and VB try helping out some of the folks in those topic areas.  I am sure they would love to see another expert help out there.

CJ
Sorry, but that code doesn't work in a VB application, which is where it MUST run.
ASKER CERTIFIED SOLUTION
Avatar of cheekycj
cheekycj
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for all your help CJ.
no problem.. Glad I could help and Good Luck!

CJ