#21905 [Com]: fopen/fsockopen via HTTPS
| From: | mike dot duncan at sonopress dot com | Date: | Tue, 28 Jan 2003 20:54:54 +0000 |
| Subject: | #21905 [Com]: fopen/fsockopen via HTTPS | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-31500@lists.php.net to get a copy of this message | ||
ID: 21905
Comment by: mike.duncan@sonopress.com
Reported By: mike.duncan@sonopress.com
Status: Bogus
Bug Type: Sockets related
Operating System: Linux
PHP Version: 4.3.0
New Comment:
Could this whole mess be hanging on the certificate passed back by the
server? I am using a self-signed cert., not a valid certificate.
Previous Comments:
------------------------------------------------------------------------
[2003-01-28 12:27:44] mike.duncan@sonopress.com
I think you are misunderstanding me. I tried fsockopen() and it failed
with "php_stream_sock_ssl_activate_with_method: SSL
handshake/connection failed...fsockopen()
[http://www.php.net/function.fsockopen]: failed to activate SSL mode 1
in..." error. This is exactly the same error reported in the Bug link
given above.
After reading that report, you suggested he use fopen() instead. This
is what I did too, but unfortunately I got the error I reported above.
What did you work out with him?
After looking into other options, I noticed that cURL lib could be used
to curl_init() the SSL first, but I think this beating around the
subject. I do not want to have to install extranious libraries all over
for this option. You state in the documentation that SSL support is in
streams for PHP v4.3.0 as long as I build in support for OpenSSL. Which
I did (see php -m above). Is there something I am missing?
------------------------------------------------------------------------
[2003-01-27 12:21:01] wez@php.net
This is not a support forum, and this is not a bug in PHP (marking as
bogus).
fsockopen("ssl://webmail.domain.com", 443) should function exactly how
you need it to for this task.
------------------------------------------------------------------------
[2003-01-27 11:24:47] mike.duncan@sonopress.com
The problem I am experiencing is close to, but not exactly, the same
problem in bug #21642. That problem was not fully explained or
understood by me and since the conversation went offline, I may never
know what actually was resolved.
I am trying to access a Outlook Web Access box via SSL (HTTPS). Because
the fsockopen() does not support SSL directly (because it starts in the
clear initially) I tried to use fopen() but because you are not allowed
to write to a HTTP-schemed, fopen()connection, I cannot see how to get
around POST'ing info to the site.
Am I missing an easier way to do this?
The error I receive with fopen() is: "failed to create stream: HTTP
wrapper does not support writeable connections". Here is a snippit of
code:
----------
$fp = fopen("https://webmail.domain.com",
"w+");
if(! $fp) {
echo "Could not connect to server.\n";
exit;
}
fputs($fp, "POST /exchange/logon.asp HTTP/1.1\r\n");
fputs($fp, ...various HTTP headers and info...);
while(! feof($fp))
echo fgets($fp, 1024);
fclose($fp);
------------
I know it may not always be necessary to POST data, but I need to know
if I must use Perl (which I can use LWP) for this. I would really like
to stick with PHP because everything else is already written in it.
Some system info...
---------
$ php -v
PHP 4.3.0 (cli) (built: Jan 24 2003 15:12:37)
Copyright (c) 1997-2002 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2002 Zend Technologies
$ php -m
[PHP Modules]
ctype
ftp
ldap
mysql
oci8
openssl
overload
pcre
posix
saprfc
session
standard
tokenizer
xml
[Zend Modules]
----------
TIA for help, comments, and/or suggestions.
Mike Duncan
Web Master/Developer
Sonopress LLC
mike.duncan@sonopress.com
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=21905&edit=1