Click to See Complete Forum and Search --> : source code using javacurl in linux
ade_ari_w0
Mar 27th, 2007, 09:01 PM
please give me source code to using javacurl in linux.
thnx
ade_ari_w0
Mar 28th, 2007, 01:07 AM
i have download javacurl in source forge.net but it's not working well in linux.
i wan to use "curl".
please give me source code for using curl.
thnx
CornedBee
Mar 29th, 2007, 08:30 AM
It's not working well ... in what way is it not working well?
System_Error
Mar 29th, 2007, 01:08 PM
please give me source code for using curl.
Why don't you give specific problems that you're having? No one is going to do your work for you whether it's homework or not. Such requests need to have some dollar signs at the end. Else, post what you're having trouble with and don't order people to spend their personal time creating code you're not willing to make yourself.
ade_ari_w0
Mar 30th, 2007, 03:45 AM
this is source code for using javacurl. i use this source code in linux but still not working.
please help me
//__________________________________________________________________-
package javaapplication;
import org.curl.*;
class test implements CurlWrite {
// static String ca_cert_file = "C:\\eclipse\\plugins\\org.curl_1.0.0\\os\\win32\\x86\\ca-bundle.crt";
static String ca_cert_file = "ca-bundle.crt";
static StringBuffer sbResponse = new StringBuffer(16384);
public int handleString(byte s[])
{
/* output everything */
// System.out.println("IIIIIIIIIII -------------- OOOOOOOOOOOOOOOOOOO");
// try {
System.out.println(s.length);
// String temp = new String(s);
sbResponse.append(new String(s));
// }
// catch (java.io.IOException moo) {
// nothing
// }
return 0;
}
public static void main(String[] args)
{
try {
test cw = null;
// Register callback write function
CurlGlue cg = new CurlGlue();
// this will throw a ERROR_NO_CALLBACK_INSTANCE exception, non-fatal
try {
cg.setopt(CURL.OPT_WRITEFUNCTION, cw);
} catch (CURLException e) {
System.out.println("Wouldn't have thrown an error if we instantiated test() first!");
}
// we must first instantiate the CurlWrite interface
cw = new test();
// set the callback function
cg.setopt(CURL.OPT_WRITEFUNCTION, cw);
cg.setopt(CURL.OPT_VERBOSE, 3);
cg.setopt(CURL.OPT_FOLLOWLOCATION, 1);
// cg.setopt(CURL.OPT_FRESH_CONNECT, 0);
// I have not tested whether or not the verify peer functions
// work with my java implementation. I will be working on this.
// Better to turn them off for now
cg.setopt(CURL.OPT_SSL_VERIFYPEER, 0);
cg.setopt(CURL.OPT_SSL_VERIFYHOST, 0);
cg.setopt(CURL.OPT_SSLCERTTYPE, "PEM");
cg.setopt(CURL.OPT_SSLVERSION, 3);
int result = cg.setopt(CURL.OPT_URL, "http://10.26.5.1/fts2-rev/frontoffice/index.html");
cg.setopt(CURL.OPT_HTTPGET, 1);
result = cg.perform();
// clean everything up.
cg.finalize();
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("***** OUTPUT STRINGBUFFER *****");
System.out.println("Bytes returned to SB: " + sbResponse.length());
String[] splits = sbResponse.toString().split("\n");
System.out.println("Num lines: " + splits.length);
System.out.println(sbResponse.toString());
}
}
//______________________________________
but this error
Exception in thread "main" org.curl.CURLError: Critical libraries couldn't be loaded
at org.curl.CURL.error(CURL.java:1473)
at org.curl.CURL.error(CURL.java:1408)
at org.curl.CURL.error(CURL.java:1399)
at org.curl.CurlGlue.error(CurlGlue.java:70)
at org.curl.CurlGlue.<clinit>(CurlGlue.java:171)
at javaapplication.test.main(test.java:34)
i use
CornedBee
Mar 30th, 2007, 12:02 PM
It can't load the native library. Have you installed curl (not JavaCurl) correctly?
ade_ari_w0
Apr 1st, 2007, 09:29 PM
i have install curl (curl-7.16.1.tar.gz) in knoppix linux but i don't know how to run this curl.
please tell me how to run curl.
thnx
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.