drasv0904 2017-04-11 07:57 采纳率: 0%
浏览 129

php curl中电报机器人的自签名证书

I just wanna send a simple request to telegram bot APIs my code is:

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.telegram.org/bot332537240:MY_TOKEN/getUpdates",
  CURLOPT_CUSTOMREQUEST => "POST",
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

returns:

cURL Error #:SSL certificate problem: self signed certificate

I don't want use any ssl. I wont set any webhook for telegram. this is a simple request and I failed to handle this. please help me

  • 写回答

1条回答 默认 最新

  • dongxiong5546 2017-04-11 08:29
    关注

    You can use CURLOPT_SSL_VERIFYPEER and set it to false in curl_setopt_array.

    CURLOPT_SSL_VERIFYPEER stop cURL from verifying the peer's SSL certificate.

    Hope it should help.

    评论

报告相同问题?