0
Help us understand the problem. What are the problem?

More than 1 year has passed since last update.

posted at

curl error 60を解決した

エラーが出ていた元のコード


//$postと$headersについては省略
$ch = curl_init('URL');
        $options = [
            CURLOPT_CUSTOMREQUEST => 'POST',
            CURLOPT_HTTPHEADER => $headers,
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_BINARYTRANSFER => true,
            CURLOPT_HEADER => true,
            CURLOPT_POSTFIELDS => $post,
        ];
        curl_setopt_array($ch, $options);

        $result = curl_exec($ch);

エラーが出なくなったコード


$ch = curl_init('URL');
        $options = [
            CURLOPT_CUSTOMREQUEST => 'POST',
            CURLOPT_HTTPHEADER => $headers,
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_BINARYTRANSFER => true,
            CURLOPT_HEADER => true,
            CURLOPT_POSTFIELDS => $post,
            CURLOPT_SSL_VERIFYPEER => false,  //追加
            CURLOPT_VERBOSE => true,          //追加
        ];
        curl_setopt_array($ch, $options);

        $result = curl_exec($ch);

参考(こちらのラインプッシュを試した際に出くわしたエラーです):https://imoni.net/tips/00xx/0012.html

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
0
Help us understand the problem. What are the problem?