2014-04-27 57 views
1
$ch = curl_init("www.example.com/curl.php?option=test"); 
    curl_setopt($ch, CURLOPT_HEADER, 0); 
    curl_setopt($ch, CURLOPT_POST, 1); 
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
    $output = curl_exec($ch);  
    curl_close($ch); 
    echo $output; 

如何添加此參數--cert和--key?如何使用CURL PHP傳遞參數--cert和--key?

如果我在控制檯使用捲曲那麼我就可以:

捲曲-k --cert new.crt --key new.key https://example.com/curl.php?option=test

,但我如何使用這PHP代碼?

回答

0

嘗試

curl_setopt($ch, CURLOPT_SSLCERT, 'new.crt'); 
curl_setopt($ch, CURLOPT_SSLKEY, 'new.key');