[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 190
  • Last Modified:

Program to Send HTTP Post data

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
cdukes
Asked:
cdukes
  • 2
  • 2
1 Solution
 
Daij-DjanCommented:
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
 
cdukesAuthor Commented:
Not very end-user friendly ;-)
0
 
Daij-DjanCommented:
it is a method you can integrate into a small app - I dont understand what you need.
0
 
cdukesAuthor Commented:
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
 
moduloCommented:
PAQed, with points refunded (125)

modulo
Community Support Moderator
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now