我的客户端给了我一个* .crt文件,一个* .der文件和一个* .txt文件,也是一个键,以便按POST发送文件。我使用curl来发送文件,但我无法弄清楚,如何。可悲的是,我对钥匙等知之甚少,你知道吗,我能做些什么?
答案 0 :(得分:0)
$ch = curl_init();
$options = array( CURLOPT_POST => 1,
CURLOPT_TIMEOUT => 0,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_SSL_VERIFYPEER => 0,
CURLOPT_SSLCERT => 'cert',
CURLOPT_SSLCERTPASSWD => 'cert pass',
CURLOPT_URL => "whatever",
CURLOPT_POSTFIELDS => $fields
);
$options[CURLOPT_SSLKEY] = 'whatever';
$options[CURLOPT_SSLKEYTYPE] = 'PEM';
$options[CURLOPT_SSLKEYPASSWD] = 'pass'; // if needed
}
curl_setopt_array($ch, $options);
$response = curl_exec($ch);
if(curl_errno($ch)) die('Curl error: '.curl_error($ch));
curl_close($ch);