Results 1 to 5 of 5

Thread: "POST" method, Connect to CGI ?

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2000
    Location
    Canada
    Posts
    7

    I did.

    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.

  2. #2
    Lively Member
    Join Date
    Jan 2000
    Location
    Omaha, Ne
    Posts
    65

    Question POST

    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.

  3. #3

    Thread Starter
    New Member
    Join Date
    May 2000
    Location
    Canada
    Posts
    7

    Article

    Yep I did,
    that will explain the GET method which is more then easy, but not the POST method.

  4. #4
    Lively Member
    Join Date
    Jan 2000
    Location
    Omaha, Ne
    Posts
    65

    Cool !

    DOH!

  5. #5
    Guest

    VB not as intuitive as you'd hope

    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();
    }
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width