From:             [EMAIL PROTECTED]
Operating system: FreeBSD 4.7-(STABLE|RELEASE)
PHP version:      4.3.1
PHP Bug Type:     cURL related
Bug description:  CURL does not work using curl_setopt($curl, CURLOPT_FILE, $fp);

Hi,

I've written some ISP management software some time ago, and I've upgraded
two servers at home in preparation for a roll out on our production
servers, to test all our PHP code works.

Some of my scripts work via the CLI other work via the mod_php version on
apache 1.3.26 / 1.3.27 versions of apache.  OpenSSL versions 0.9.6g and
0.9.7 have been tested.

On php 4.2.3 with curl version's 7.9.8 and 7.10.3 I do not get this
problem.  On 4.3.0 and 4.3.1 I have this error where (a) I don't get
anything data in the $fp file descriptor and (b) it's moans about the
following:

===
[EMAIL PROTECTED]:/usr/local/vweb/stats.ataris.co.za/data/cacti/scripts# php
uudial.php
* About to connect() to waggle.ops.uunet.co.za:443
* Connected to waggle.ops.uunet.co.za (196.7.0.184) port 443
* SSL: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate
verify failed
* Closing connection #0
SSL: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate
verify failed
Array
(
    [data] =>
    [http_code] => 0
)
Cannot get UUnet Session ID
===

Tried using the following CURL SETOPT's:
 * CURLOPT_SSL_VERIFYPEER
 * CURLOPT_SSLVERSION
 * CURLOPT_SSL_VERIFYHOST

Snipbit from my UUdial class function getSecureCookie.

$fp = tmpfile();
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $uunet_url);
curl_setopt($curl, CURLOPT_TIMEOUT, 20);
curl_setopt($curl, CURLOPT_FILE, $fp);
curl_setopt($curl, CURLOPT_USERPWD, $uunet['login']);
curl_setopt($curl, CURLOPT_PROXY, "http://192.168.10.254:3128/";);
curl_exec($curl);

$response['http_code'] = curl_getinfo($curl, CURLINFO_HTTP_CODE); /* This
is used to see if we get a HTTP 200 code */

rewind($fp);
while ($str = fgets($fp, 4096)) {
        $pairs .= $str;
}
fclose($fp);

$response['data'] = $pairs;
asort($response);

if ($response['http_code'] == "200") {
        preg_match ('/<frame src=".*?auth_cookie=([\w]+:[\w]+)">/ims',
$response['data'], $n);
        if ($n[1]) {
                $this->cookie = $n[1];
        } else {
                die ("Cannot get UUnet Secure Cookie");
        }
} else {
        die ("Cannot get UUnet Secure Cookie");
}
-- 
Edit bug report at http://bugs.php.net/?id=22517&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=22517&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=22517&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=22517&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=22517&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=22517&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=22517&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=22517&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=22517&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=22517&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=22517&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=22517&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=22517&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=22517&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=22517&r=gnused

Reply via email to