Solved

Program to Send HTTP Post data

Posted on 2004-09-12
7
181 Views
Last Modified: 2008-03-06
Is there a windows program already built that will allow me to send Post data to a server?
I want to post the same data multiple times throughout the day at specified times.
I need a program that can do this as opposed to a script like php, etc. something easy that end users can use.

0
Comment
Question by:cdukes
  • 2
  • 2
7 Comments
 
LVL 5

Expert Comment

by:Daij-Djan
ID: 12041549
code in java

  /**
   * Connect to the url specified and tell it via POSTing there is new data on the server.
   * @param url Url to call (can be anything  but should handle POSTs).
   * @param _strId id of the file we uploaded earilier (id=integer_as_string POSTed).
   */
  private static void ConnectToUrl( CURLConfig _oUrlConfig, String _strId ) throws IOException
  {
    URL url = _oUrlConfig.getConnection();
    URLConnection urlConn;
    DataOutputStream printout;
    DataInputStream input;
    // URL of CGI-Bin script.
    // URL connection channel.
    urlConn = url.openConnection();
    // Let the run-time system (RTS) know that we want input.
    urlConn.setDoInput( true );
    // Let the RTS know that we want to do output.
    urlConn.setDoOutput( true );
    // No caching, we want the real thing.
    urlConn.setUseCaches( false );
    // Specify the content type.
    urlConn.setRequestProperty( "Content-Type",
                        "application/x-www-form-urlencoded" );
    // Send POST output.
    printout = new DataOutputStream( urlConn.getOutputStream() );
    String content = "identifier=" + URLEncoder.encode( _strId ) + "&Login=" + URLEncoder.encode( _oUrlConfig.getUser() ) + "&Password=" + URLEncoder.encode( _oUrlConfig.getPassword() );
    printout.writeBytes( content );
    printout.flush();
    printout.close();
    // Get response data.
    input = new DataInputStream( urlConn.getInputStream() );
    String str;
    while ( null != ( ( str = input.readLine() ) ) )
    {
      System.out.println( str );
    }
    input.close();
  }
0
 

Author Comment

by:cdukes
ID: 12051116
Not very end-user friendly ;-)
0
 
LVL 5

Expert Comment

by:Daij-Djan
ID: 12053753
it is a method you can integrate into a small app - I dont understand what you need.
0
 

Author Comment

by:cdukes
ID: 12065951
I need the small app, something easy to use for an end-user.
...
I believe I have found what I am looking for though, so thanks for the advice anyways :-)

For anyone else who is searching for the same thing, here's a link:
http://www.codeproject.com/internet/httpget-post.asp
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 12446947
PAQed, with points refunded (125)

modulo
Community Support Moderator
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Windows Script Host (WSH) has been part of Windows since Windows NT4. Windows Script Host provides architecture for building dynamic scripts that consist of a core object model, scripting hosts, and scripting engines. The key components of Window…
If you haven’t already, I encourage you to read the first article (http://www.experts-exchange.com/articles/18680/An-Introduction-to-R-Programming-and-R-Studio.html) in my series to gain a basic foundation of R and R Studio.  You will also find the …
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

792 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