I'm running PHP 4.3.3 compiled with --with-openssl against Red Hat 8.0's 
latest OpenSSL libraries (patched versions of 0.9.6) and am having some 
strange issues using fopen(), fread() and friends.  Here's my code:

function echo_test() {
  $opts = array(
            'ssl' => array(
              'allow_self_signed' => "TRUE"
                          )
               );
  $context = stream_context_create($opts);

  $handle = fopen("https://www.secureurl.org/";, "r", FALSE, $context);

  while (TRUE) {
    $data = fread($handle, 1024);
    if (strlen($data) == 0) {
      break;
    }
    $stuff .= stripslashes($data);
  }
  fclose($handle);
  return $stuff;
}

When I run this code, the content IS returned correctly and in in the 
server SSL logs I see that a request was made via SSL.  So I'm getting 
the results I want... EXCEPT for this:

Warning: fread(): SSL: fatal protocol error in /WWW/inc/ECHO.php on line 
23

Any idea what this is?  I thought not allowing self signed certs might 
be the problem since this server is using a self-signed one... but 
adding that to my options (reflected above) didn't help any.

I can very easily force the errors not to show up and mosey on since I 
am able to access the data, but I'm curious why this is happening.  Any 
ideas?  There were a few other posts on this topic, but none with any 
concrete answers or solutions...

-- 
Ray Van Dolson ([EMAIL PROTECTED])
http://www.bludgeon.org/~rayvd/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to