Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Executing cgi script from applet

Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
Im having trouble executing my cgi script from an applet I've written. Hopefully someone can tell me what Im doing wrong.
My main goal is to write some data from an applet to a file using a simple cgi script. For example if you type this URL into your browser:
it will write 'test' to a file called 'wd.txt' at:
The problem is i cant seem to execute this script from my applet, or at least it doesn't seem to do anything. Here's the main bit of code:

public void CGIPost(String data) throws Exception {
URLurl = new URL("";);
HttpURLConnection connection = (HttpURLConnection)url.openConnection();
System.out.println("opoening connection to test1.cgi and sending 5555: URL is " + url);
The applet is loaded onto the server and no exceptions are thrown when running the applet. However, nothing is written to wd.txt.
Any help would be much appreciated.
Rich can test the applet here:
Here is the cgi script if it is a help:
use CGI::Carp qw(fatalsToBrowser);
print OUT $data;
print "Content-type:text/html\n\n";
print <<EndHTML>
The string sent was $data


That which doesn't kill us makes us stronger. I think a piece of pie wouldn't kill me. Tiny ad:
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic