---
slug: "phpの-zend_http_client-で-tls12-接続する"
title: "PHPの Zend_Http_Client で TLS1.2 接続する"
description: "$client = new Zend_Http_Client($url);$response = $client-&gt;request('GET');\nみたいな感じでしてたんですが、OSの問題なのか、TLS1.2で接続できてませんでした。"
url: "https://www.ytyng.com/blog/phpの-zend_http_client-で-tls12-接続する"
publish_date: "2017-12-21T09:39:24Z"
created: "2017-12-21T09:39:24Z"
updated: "2026-02-27T11:49:57.499Z"
categories: []
keywords: ""
featured_image_url: "https://media.ytyng.com/resize/20230812/06f8518376c74517bd98ed1473331544.png.webp?width=768"
has_video: false
has_music: false
video_urls: []
music_urls: []
lang: "ja"
---

# PHPの Zend_Http_Client で TLS1.2 接続する

<pre><span>$client = new Zend_Http_Client($url);<br /></span><span>$response = $client-&gt;request('GET');</span></pre>
<p><span>みたいな感じでしてたんですが、OSの問題なのか、TLS1.2で接続できてませんでした。</span></p>
<p></p>
<p>CURL アダプタを使うようにしたらうまくいきました。</p>
<pre><span>$config = array(</span><br /><span>&nbsp; &nbsp;'adapter' &nbsp; &nbsp; &nbsp;=&gt; 'Zend_Http_Client_Adapter_Curl',</span><br /><span>&nbsp; &nbsp;'curloptions' &nbsp;=&gt; array(CURLOPT_SSLVERSION =&gt; 6),</span><br /><span>);</span><br /><span>$client = new Zend_Http_Client($url, $config);</span></pre>
<p><span></span></p>
<p>※&nbsp;<span><code>CURLOPT_SSLVERSION =&gt; 6</code> が<strong>TLS1.2</strong>。<code>5</code> だと<strong>1.1</strong>。</span></p>
<p><span></span></p>
<p><span><a href="https://www.howsmyssl.com/a/check">https://www.howsmyssl.com/a/check</a><a rel="nofollow noreferrer" target="_blank" href="https://www.google.com/url?q=https%3A%2F%2Fwww.howsmyssl.com%2Fa%2Fcheck&amp;sa=D&amp;sntz=1&amp;usg=AFQjCNEaEIVvyrEytyJrmAAAc2NauEL_Sg" class="Xx" dir="ltr" data-display="https://www.howsmyssl.com/a/check" data-sanitized="https://www.google.com/url?q=https%3A%2F%2Fwww.howsmyssl.com%2Fa%2Fcheck&amp;sa=D&amp;sntz=1&amp;usg=AFQjCNEaEIVvyrEytyJrmAAAc2NauEL_Sg" tabindex="-1"></a></span></p>
<p><span>このサイトが、暗号プロトコルのチェックにとても便利。</span></p>
<p><br /><span></span></p>
<p><span>Use of undefined constant CURL_SSLVERSION_TLSv1_2 &middot; Issue #26 &middot; wepay/PHP-SDK<br /><a href="https://github.com/wepay/PHP-SDK/issues/26">https://github.com/wepay/PHP-SDK/issues/26</a></span></p>
<p><span>このページがとても参考になった。</span></p>
