CURL-PHP to Java-HTTPComponents

Discussion in 'Java' started by LMario, Oct 25, 2012.

  1. LMario

    LMario Guest

    Somebody can help to me to rewrite to next CURL PHP code to Java HTTPComponents:

    $process = curl_init('https://www.test.com/directory');
    curl_setopt($process, CURLOPT_HTTPHEADER, array('Content-Type: text/xml', 'charset=utf-8'));
    curl_setopt($process, CURLOPT_POSTFIELDS, $sob->saveXML());
    curl_setopt($process, CURLOPT_SSLCERT, '123456789.cer');
    curl_setopt($process, CURLOPT_SSLCERTPASSWD, "123456789");
    curl_setopt($process, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($process, CURLOPT_POST, true);
    curl_setopt($process, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($process, CURLOPT_SSL_VERIFYHOST, false);
    $answer = curl_exec($process);
    curl_close($process);
     
    LMario, Oct 25, 2012
    #1
    1. Advertising

  2. LMario

    Jim Gibson Guest

    In article <>,
    LMario <> wrote:

    > Somebody can help to me to rewrite to next CURL PHP code to Java
    > HTTPComponents:
    >
    > $process = curl_init('https://www.test.com/directory');
    > curl_setopt($process, CURLOPT_HTTPHEADER, array('Content-Type: text/xml',
    > 'charset=utf-8'));
    > curl_setopt($process, CURLOPT_POSTFIELDS, $sob->saveXML());
    > curl_setopt($process, CURLOPT_SSLCERT, '123456789.cer');
    > curl_setopt($process, CURLOPT_SSLCERTPASSWD, "123456789");
    > curl_setopt($process, CURLOPT_RETURNTRANSFER, true);
    > curl_setopt($process, CURLOPT_POST, true);
    > curl_setopt($process, CURLOPT_SSL_VERIFYPEER, false);
    > curl_setopt($process, CURLOPT_SSL_VERIFYHOST, false);
    > $answer = curl_exec($process);
    > curl_close($process);


    If you google for "java curl", the first three hits are pretty much
    your question. No idea if the answers are any good.

    --
    Jim Gibson
     
    Jim Gibson, Oct 26, 2012
    #2
    1. Advertising

  3. LMario

    LMario Guest

    Yes, you're right, but it seems the answers are incomplete because they do not handle the authentication nor the sending of string data (variable $sob) to the server nor SSL verification.

    I hope somebody can help me with my post.
     
    LMario, Oct 26, 2012
    #3
  4. LMario

    Joerg Meier Guest

    On Thu, 25 Oct 2012 20:01:39 -0700 (PDT), LMario wrote:

    > Yes, you're right, but it seems the answers are incomplete because they do not handle the authentication nor the sending of string data (variable $sob) to the server nor SSL verification.


    > I hope somebody can help me with my post.


    Show us what you've got that doesn't do what you want. For debugging, I can
    recommend Wireshark, which would let you compare request A with request B
    to see where your Java one doesn't look like the PHP one.

    Liebe Gruesse,
    Joerg

    --
    Ich lese meine Emails nicht, replies to Email bleiben also leider
    ungelesen.
     
    Joerg Meier, Oct 26, 2012
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Chris

    cURL in ASP.NET

    Chris, Dec 17, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    8,289
    Joerg Jooss
    Dec 19, 2004
  2. raviraj joshi
    Replies:
    0
    Views:
    361
    raviraj joshi
    Jul 4, 2009
  3. reshma shinde
    Replies:
    0
    Views:
    431
    reshma shinde
    Jul 4, 2009
  4. Rajive Narain
    Replies:
    0
    Views:
    2,097
    Rajive Narain
    Sep 18, 2009
  5. raviraj joshi
    Replies:
    0
    Views:
    186
    raviraj joshi
    Jul 4, 2009
Loading...

Share This Page