Skip to content

Instantly share code, notes, and snippets.

@kino0104
Created August 28, 2014 02:04
Show Gist options
  • Save kino0104/8c198481558fc3537b98 to your computer and use it in GitHub Desktop.
Save kino0104/8c198481558fc3537b98 to your computer and use it in GitHub Desktop.
PHPでcurlを使ってHTTPSにアクセスしてエラー出たときの回避策 ref: http://qiita.com/kino0104/items/8a6a6dc2404c27bc43ea
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($params));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
//下記一行を追加
curl_setopt($curl,CURLOPT_SSL_VERIFYPEER, false);
$res = curl_exec($curl);
curl_close($curl);
var_dump($res);
exit;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment