PHP.mk документација

Интернет домен: TCP, UDP, SSL и TLS

Почист и полокален преглед на PHP референцата, со задржана структура од PHP.net и подобра читливост за примери, секции и белешки.

transports.inet.php PHP.net прокси Преводот се освежува
Оригинал на PHP.net
Патека transports.inet.php Локална патека за оваа страница.
Извор php.net/manual/en Оригиналниот HTML се реупотребува и локално се стилизира.
Режим Прокси + превод во позадина Кодовите, табелите и белешките остануваат читливи во истиот тек.
Интернет домен: TCP, UDP, SSL и TLS

Референца за `transports.inet.php` со подобрена типографија и навигација.

transports.inet.php

Интернет домен: TCP, UDP, SSL и TLS

ssl://, tls://, sslv2:// & sslv3://.

Забелешка: На sslv2:// and sslv3:// transports are obsolete and should not be used. They are documented for backward compatibility only.

Забелешка: If no transport is specified, tcp:// will be assumed.

  • 127.0.0.1
  • fe80::1
  • www.example.com
  • tcp://127.0.0.1
  • tcp://fe80::1
  • tcp://www.example.com
  • udp://www.example.com
  • ssl://www.example.com
  • tls://www.example.com

Internet Domain sockets expect a port number in addition to a target address. In the case of fsockopen() this is specified in a second parameter and therefore does not impact the formatting of transport URL. With stream_socket_client() and related functions as with traditional URLs however, the port number is specified as a suffix of the transport URL delimited by a colon.

  • tcp://127.0.0.1:80
  • tcp://[fe80::1]:80
  • tcp://www.example.com:80

Забелешка: IPv6 numeric addresses with port numbers
In the second example above, while the IPv4 and hostname examples are left untouched apart from the addition of their colon and portnumber, the IPv6 address is wrapped in square brackets: [fe80::1]. This is to distinguish between the colons used in an IPv6 address and the colon used to delimit the portnumber.

На ssl:// and tls:// transports (available only when openssl support is compiled into PHP) are extensions of the tcp:// transport which include SSL encryption.

ssl:// will attempt to negotiate a secure SSL/TLS connection depending on the capabilities and preferences of both the client and the remote host. The actual protocols that may be used are determined by the OpenSSL configuration and by any options provided through stream_context_create(), како на пр. ssl.crypto_method.

The SSLv2 and SSLv3 protocols are obsolete and insecure. Their use is strongly discouraged and they are no longer enabled by default in modern versions of PHP and OpenSSL.

Белешки од корисници 2 забелешки

christian at lantian dot eu
12 години пред
@pablo dot livardo  :  I think that the problem you found is caused by the difference between the client/server encryption methods used.

The 465 port is used for SMTPS, and the server starts the encryption immediately it receives your connection. So, your code will work.

The 587 port is used for Submission (MSA or Mail Submission Agent) which works like the port 25. The server accepts your connection and doesn't activate the encryption. If you want an encrypted connection on the port 587, you must connect on it without encryption, you must start to dialog with the server (with EHLO) and after that you must ask the server to start the encrypted connection using the STARTTLS command. The server starts the encryption and now you can start as well the encryption on your client. 

So, in few words, you can not use : 

<?php $fp = fsockopen("tls://mail.example.com", 587, $errno, $errstr);  ?>  

but you can use:

 <?php $fp = stream_socket_client("mail.example.com:587", $errno, $errstr); ?>  

and after you send the STARTTLS command, you can enable the crypto:

<?php stream_socket_enable_crypto($fp, true, STREAM_CRYPTO_METHOD_SSLv23_CLIENT); ?>

P.S. My previous note on this page was totally wrong, so I ask the php.net admin to remove it.

:)
stefan at example dot com
пред 15 години
Actually, PHP is very able to start with an unencrypted connection and then switch to an encrypted one - refer to http://php.net/stream_socket_enable_crypto .
На оваа страница

Автоматски outline од активната документација.

Насловите ќе се појават тука по вчитување.

Попрегледно читање

Примерите, changelog табелите и user notes се визуелно издвоени за да не се губат во долгата содржина.

Брз совет Користи го outline-от Скокни директно на главните секции од активната страница.
Извор Оригиналниот линк останува достапен Кога ти треба целосен upstream context, отвори го PHP.net во нов tab.