cURL / Mailing Lists / curl-users / Single Mail

curl-users

Curl In JSP

From: Lenny Sorey <lrsorey_at_fatdot.com>
Date: Wed, 25 Feb 2004 14:53:40 -0600

Good day all,

I am using Curl.exe from a command line in order to post information via HTTP.

I want to use Curl in a JSP which is a requirement of my customer.

I have placed the curl.exe in my jsp directory from which I'm launching my jsp which contains
the Runtime.getRuntime().

I can run Curl with success from a command line with the parameters show below and get the desired results.

When I try to use the same command line within my jsp as shown below, I get a blank page.

Any guidance here would certainly be appreciated.

Thanks in advance.

Lenny Sorey

Platform is as follows:

Win 2K server
J2SDK 1.4.2
Tomcat 4.1.29
curl-7.9-win32-nossl

try{

Runtime r = Runtime.getRuntime();
String mycurl = "curl.exe -e http://www.ffiec.gov/geocode/default.htm -v "www.ffiec.gov/geocode/GeocodeSearchmapping.htm?census_year=2003
&street_address=1140
+Ridgewood+Blvd&City=Jackson&State=MS+&zip_code=39211&Search=+++++Search++++";

Process p = r.exec(mycurl);

InputStream is = p.getInputStream();
StringBuffer buf=new StringBuffer();
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
int readByte = -1;
while ((readByte = is.read()) > -1) {
buf.append((char)readByte);
}

mybuf = buf.toString();

out.println(mybuf);

}catch(Exception e){
e.printStackTrace();

%>
Received on 2004-02-25