VMware {code} Community
Lapsang28
Contributor
Contributor
Jump to solution

PHP Curl and check ssl

Hello everyone,

I try to build a php class in order to use workflows in Orchestrator.

I can use many requests, using this code :

$curl        = curl_init();

        $url         = $this->url . 'catalog/System/Workflow/';

        $curlOptions = array(

            CURLOPT_URL           => $url,

            CURLOPT_CUSTOMREQUEST => "GET",

            CURLOPT_HTTPAUTH       => CURLAUTH_BASIC,

            CURLOPT_SSLVERSION     => 3,

            CURLOPT_SSL_VERIFYPEER => 0,

            CURLOPT_SSL_VERIFYHOST => 0,

            CURLOPT_USERPWD        => "$this->username:$this->password",

            CURLOPT_RETURNTRANSFER => true,

            CURLOPT_HEADER => true

        );

        curl_setopt_array($curl, $curlOptions + $this->curlOptDefaults);

        $content     = curl_exec($curl);

        if(curl_errno($curl) != 0)

        {

            echo "Error CURL : " . curl_error($curl);

            die('');

        }

        $tabWorkFlows = json_decode($content, true);

But when I add this header

CURLOPT_HTTPHEADER     => 'Content-Type: application/xml'

I always have the issue :

SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

even if I leave ssl_verifypeer et ssl verifyhost to 0. Have someone meet this problem ?

Feel free to ask more if needed.

0 Kudos
1 Solution

Accepted Solutions
schepp
Leadership
Leadership
Jump to solution

Hi,

might be a problem that CURLOPT_HTTPHEADER expects an array.

Tim

View solution in original post

0 Kudos
2 Replies
schepp
Leadership
Leadership
Jump to solution

Hi,

might be a problem that CURLOPT_HTTPHEADER expects an array.

Tim

0 Kudos
Lapsang28
Contributor
Contributor
Jump to solution

Thanks, you saved my day !

0 Kudos