Results 1 to 7 of 7

Thread: source code using javacurl in linux

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2007
    Posts
    26

    source code using javacurl in linux

    please give me source code to using javacurl in linux.

    thnx

  2. #2

    Thread Starter
    Junior Member
    Join Date
    Mar 2007
    Posts
    26

    Re: source code using javacurl in linux

    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

  3. #3
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: source code using javacurl in linux

    It's not working well ... in what way is it not working well?
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  4. #4
    Frenzied Member System_Error's Avatar
    Join Date
    Apr 2004
    Posts
    1,111

    Re: source code using javacurl in linux

    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.

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Mar 2007
    Posts
    26

    Re: source code using javacurl in linux

    this is source code for using javacurl. i use this source code in linux but still not working.
    please help me
    Code:
    //__________________________________________________________________-
    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
    Last edited by Hack; Mar 30th, 2007 at 05:39 AM. Reason: Added [code] [/code] tags for more clarity.

  6. #6
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: source code using javacurl in linux

    It can't load the native library. Have you installed curl (not JavaCurl) correctly?
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Mar 2007
    Posts
    26

    Re: source code using javacurl in linux

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width