使用php通过API实现两台服务器之间的ssl连接

使用php通过API实现两台服务器之间的ssl连接,php,ssl,curl,Php,Ssl,Curl,我有两台服务器,这两台服务器通过使用curl的API连接 但是我的客户端需要通过服务器SSL连接。 但是我不知道这个过程 $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; Bter PHP bot; '.php_uname('a').'; PHP/'.phpvers

我有两台服务器,这两台服务器通过使用curl的API连接 但是我的客户端需要通过服务器SSL连接。 但是我不知道这个过程

 $ch = curl_init();
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_USERAGENT,
    'Mozilla/4.0 (compatible; Bter PHP bot; '.php_uname('a').'; PHP/'.phpversion().')'
    );
curl_setopt($ch, CURLOPT_URL, 'http://server2/index.php/api/'.$path);

curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);

// run the query
$res = curl_exec($ch); 
我怎样才能使服务器之间的ssl连接任何人请帮助我


提前感谢

如果将其更改为
curl\u setopt($ch,CURLOPT\u URL,'https://server2/index.php/api/“.$path)?如果我在curl url上给出了正确的url,但是我们的客户机说“需要通过SSL连接”,那么我从服务器2得到了正确的响应。因此,请指导如何使ssl连接。如果我错了,请纠正我如果将其更改为
curl\u setopt($ch,CURLOPT\u URL,'https://server2/index.php/api/“.$path)?如果我在curl url上给出了正确的url,但是我们的客户机说“需要通过SSL连接”,那么我从服务器2得到了正确的响应。因此,请指导如何使ssl连接。如果我错了,请纠正我