cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

veryifypeer and verifyhost questions

From: WILLIAM T <will3477_at_yahoo.com>
Date: Mon, 9 Sep 2002 19:23:03 -0700 (PDT)

I am unsure of how to utilize the verifypeer and
verifyhost. I know that it is planned to make at
least verifypeer the default, but it still seems like
these two options in particular need better
documentation. My code "simplified" looks like this:

$session = curl_init();
curl_setopt($session, CAINFO, $cert_file);
curl_setopt($session, SSL_VERIFYPEER, 1);
curl_setopt($session, SSL_VERIFYHOST, 2);

In reality i Have some more things (like closing the
session but I think this should be enough for people
to help me.

First of all $cert_file is just set to the name of the
pem file containing a bunch of ca certificates is this
correct?

Second, what parameter should I be sending verify peer
(ie is 1 correct) I got the one from some C code
utilizing libcurl.

Finally, for verify host in libcurl 1 makes sure a
host is listed on the certificate and 2 actually makes
sure that host is the on you are connected to. (at
least this is my understanding). They both have to be
longs in libcurl, but since php doesn't have explicit
variables I figured this didn't matter. Does the 1
and 2 thing still hold true? The first test case I
had testing this, I receieved NO errors (as far as I
can tell), but the hostname on the certificate was
invalid.

WHy I say think, is becuase my code:

ob_start();
curl_exec ($session);
$page = ob_get_contents();
ob_end_clean();

returns the page with a 0 at the end. It seems like a
zero would signify a failure, but I tried just a
simple get page, and it always returns a zero too.

Sorry about all the questions, I've really tried
finding the answers on my own.

Thanks,
William

=====

__________________________________________________
Yahoo! - We Remember
9-11: A tribute to the more than 3,000 lives lost
http://dir.remember.yahoo.com/tribute

-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone? Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390
Received on 2002-09-10