October 23, 2018
Hot Topics:

Data access via the Web

  • May 25, 1999
  • By Piroz Mohseni
  • Send Email »
  • More Articles »

import java.util.*;
import java.net.*;
import java.io.*;

public class testHTTP
  public static void main( String argv[] ) throws IOException
    String cgiscript = 
       " http://www.gamelon.com/somedir/getinfo.cgi";
    String query = null;
    String line = "";
    query = "lname=jones&id=123";
// if your Java program is running behind the firewall and you need to 
// set a proxy, use the following lines
//    System.getProperties().put( "proxySet", "true" );
//    System.getProperties().put( "proxyHost", 
//          "proxy url goes here");
//    System.getProperties().put( "proxyPort", "8000" );

      URL url = new URL(cgiscript);
      URLConnection connection = 
      connection.setDoInput( true );
      connection.setDoOutput( true );

      DataOutputStream output = new DataOutputStream( 
           connection.getOutputStream() ); 
      output.writeBytes( query );

      BufferedReader input = new BufferedReader(new 

      while ((line = input.readLine()) != null)
    catch( Exception e ) {}

Page 3 of 3

Comment and Contribute


(Maximum characters: 1200). You have characters left.



Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

By submitting your information, you agree that developer.com may send you developer offers via email, phone and text message, as well as email offers about other products and services that developer believes may be of interest to you. developer will process your information in accordance with the Quinstreet Privacy Policy.


Thanks for your registration, follow us on our social networks to keep up-to-date