Hello,

I searched the list for quite a while and have not found any recent
discussions on this.

I am connecting to a WebService using Zend_Http_Client, and I need to
validate the Server Certificate as a Security precaution. 

There is an example at the following URL that suggests that it should be
working:
http://framework.zend.com/manual/en/zend.http.client.adapters.html

Example #2 shows the options to pass to the adapter as:

'ssl' => array(
        // Verify server side certificate,
        // do not accept invalid or self-signed SSL certificates
        'verify_peer' => true,
        'allow_self_signed' => false
)

I have the following code for a simple test case:


// Array of options
$ClientOptions = array(
                'ssl' => array(
                                // Verify server side certificate,
                                // do not accept invalid or self-signed SSL 
certificates
                                'verify_peer' => true,
                                'allow_self_signed' => false
                )
);

$adapter = new Zend_Http_Client_Adapter_Socket();
$adapter->setStreamContext($ClientOptions);
$client = new Zend_Http_Client();
$client->setAdapter($adapter);

$client->setUri('https://www.google.com');

$response = $client->request();

print $response->getBody();

I receive an Exception with the following error:

Unable to Connect to ssl://www.google.com:443. Error #0: 
at
/usr/local/zend/share/ZendFramework/library/Zend/Http/Client/Adapter/Socket.php
line 235

If I change the 'verify_peer' to false, the code executes flawlessly.

What am I missing?

Thanks

-- Joseph

--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/Zend-Http-Client-Certificate-Validation-tp4384509p4384509.html
Sent from the Zend Framework mailing list archive at Nabble.com.

-- 
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]


Reply via email to