Ignore SSL Errors in Zend_Http_Client

There are two functions in PHP curl that are used to ignore all SSL errors (invalid certificate, self-signed, expired, etc.):

curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

I am moving on to using Zend_Http_Client, but I cannot find a way to make it ignore errors. (I don’t have the opportunity to check this yet, I would like to see if anyone has done this before)

So, does anyone know the equivalent function / functions for this in Zend_Http_Client?

+5
source share
1 answer

You can do something like this,

   $connection = new Zend_Http_Client();
   $streamOpts = array(
            'ssl' => array(
                'verify_peer' => false,
                'allow_self_signed' => true
             )
   );

   $adapter = new Zend_Http_Client_Adapter_Socket();
   $connection->setAdapter($adapter);
   $adapter->setStreamContext($streamOpts);
+2
source

All Articles