Tahnx for reply,
yes I have an Inet1 on the form, but even then it seems to work only sometimes. This code was the only one I was able to find anywhere.
Printable View
Tahnx for reply,
yes I have an Inet1 on the form, but even then it seems to work only sometimes. This code was the only one I was able to find anywhere.
Have you read this article yet? I have yet to try it myself but it looks promising to me.
http://www.vbsquare.com/internet/cgi/
Hope it helps.
Yep I did,
that will explain the GET method which is more then easy, but not the POST method.
DOH!
I "posted" about the same difficulty about a year ago. VB gave me intermittent results as well. I think a solution was given (in that thread), but Java has not let me down with the client/server model (and was the first to show correct results).
Depending on your needs, you might prefer to think outside of the box at
"http://java.sun.com/docs/books/tutorial/networking/urls/readingWriting.html".
Scroll down to "Writing to a URLConnection" and modify as follows:
import java.io.*;
import java.net.*;
public class VBsuxAtThis {
public static void main(String[] args) throws Exception {
String strURL = "http://bohemiatrading.com/cgi-bin/protect/register.cgi";
String strFormData = "lname=LastName&fname=FirstName";
//This is comment1...You may not need the next line...see comment2
String strFormDataENCODED = URLEncoder.encode(strFormData);
URL url = new URL(strURL);
URLConnection connection = url.openConnection();
connection.setDoOutput(true);
PrintWriter out = new PrintWriter(
connection.getOutputStream());
//This is comment2...You can probably get by using
// out.println(strFormData);
//instead of the next line
out.println(strFormDataENCODED);
out.close();
BufferedReader in = new BufferedReader(
new InputStreamReader(
connection.getInputStream()));
String inputLine;
while ((inputLine = in.readLine()) != null)
System.out.println(inputLine);
in.close();
}
}