Skip to Main Content

Infrastructure Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Issue connecting to HTTPS site through CURL

807557Apr 28 2010 — edited Apr 29 2010
All,

I am having trouble requesting info from HTTPS site using CURL and PHP. I am using Solaris 10. It so happens that sometimes it works and sometimes it doesn't. I am not sure what is the cause. If it doesn't work, this is the entry recorded in the verbose log:
* About to connect() to 10.10.101.12 port 443 (#0)
*   Trying 10.10.101.12... * connected
* Connected to 10.10.101.12 (10.10.101.12) port 443 (#0)
* error setting certificate verify locations, continuing anyway:
*   CAfile: /etc/opt/webstack/curl/curlCA
  CApath: none
* error:80089077:lib(128):func(137):reason(119)
* Closing connection #0
If it works, this is the entry recorded in the verbose log:
* About to connect() to 10.10.101.12 port 443 (#0)
*   Trying 10.10.101.12... * connected
* Connected to 10.10.101.12 (10.10.101.12) port 443 (#0)
* error setting certificate verify locations, continuing anyway:
*   CAfile: /etc/opt/webstack/curl/curlCA
  CApath: none
* SSL connection using DHE-RSA-AES256-SHA
* Server certificate:
*        subject: C=CA, ST=British Columnbia, L=Vancouver, O=google, OU=FDN, CN=g.googlenet.com, emailAddress=gxiu@googlenet.com
*        start date: 2007-07-24 23:06:32 GMT
*        expire date: 2027-09-07 23:06:32 GMT
*        issuer: C=US, ST=California, L=Sunnyvale, O=Google, OU=Certificate Authority, CN=support, emailAddress=support@google.com
*        SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
POST /gportal/gpmgr HTTP/1.1^M
Host: 10.10.101.12^M Accept: */*^M Accept-Encoding: gzip,deflate^M Content-Length: 1623^M Content-Type: application/x-www-form-urlencoded^M Expect: 100-continue^M ^M < HTTP/1.1 100 Continue^M < HTTP/1.1 200 OK^M < Date: Wed, 28 Apr 2010 21:56:15 GMT^M < Server: Apache^M < Cache-Control: no-cache^M < Pragma: no-cache^M < Vary: Accept-Encoding^M < Content-Encoding: gzip^M < Content-Length: 1453^M < Content-Type: application/json^M < ^M * Connection #0 to host 10.10.101.12 left intact * Closing connection #0
My CURL options are as under:
    $ch = curl_init();

    $devnull = fopen('/tmp/curlcookie.txt', 'w');
    $fp_err = fopen('/tmp/verbose_file.txt', 'ab+');
    fwrite($fp_err, date('Y-m-d H:i:s')."\n\n");

    curl_setopt($ch, CURLOPT_STDERR, $devnull);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_URL, $desturl);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
    curl_setopt($ch, CURLOPT_HEADER, false);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT,120);
    curl_setopt($ch, CURLOPT_AUTOREFERER, true);
    curl_setopt($ch, CURLOPT_ENCODING, 'gzip,deflate');
    curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
    curl_setopt($ch, CURLOPT_VERBOSE,1);
    curl_setopt($ch, CURLOPT_FAILONERROR, true);
    curl_setopt($ch, CURLOPT_STDERR, $fp_err);

    $ret = curl_exec($ch);
Anybody has any idea, why it works sometimes but fails mostly? The error I am trying to solve is error:80089077:lib(128):func(137):reason(119)

Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 27 2010
Added on Apr 28 2010
3 comments
743 views