Solved

Program to Send HTTP Post data

Posted on 2004-09-12
7
177 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

867 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now