<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Internet Domain: TCP, UDP, SSL, and TLS</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="transports.html">List of Supported Socket Transports</a></div> <div class="next" style="text-align: right; float: right;"><a href="transports.unix.html">Unix Domain: Unix and UDG</a></div> <div class="up"><a href="transports.html">List of Supported Socket Transports</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="transports.inet" class="section"> <h2 class="title">Internet Domain: TCP, UDP, SSL, and TLS</h2> <p class="simpara"> PHP 4, PHP 5. <em>ssl://</em> & <em>tls://</em> since PHP 4.3.0 <em>sslv2://</em> & <em>sslv3://</em> since PHP 5.0.2 </p> <blockquote class="note"><p><strong class="note">Note</strong>: <span class="simpara"> If no transport is specified, <em>tcp://</em> will be assumed. </span> </p></blockquote> <ul class="itemizedlist"> <li class="listitem"><span class="simpara"><em>127.0.0.1</em></span></li> <li class="listitem"><span class="simpara"><em>fe80::1</em></span></li> <li class="listitem"><span class="simpara"><em>www.example.com</em></span></li> <li class="listitem"><span class="simpara"><em>tcp://127.0.0.1</em></span></li> <li class="listitem"><span class="simpara"><em>tcp://fe80::1</em></span></li> <li class="listitem"><span class="simpara"><em>tcp://www.example.com</em></span></li> <li class="listitem"><span class="simpara"><em>udp://www.example.com</em></span></li> <li class="listitem"><span class="simpara"><em>ssl://www.example.com</em></span></li> <li class="listitem"><span class="simpara"><em>sslv2://www.example.com</em></span></li> <li class="listitem"><span class="simpara"><em>sslv3://www.example.com</em></span></li> <li class="listitem"><span class="simpara"><em>tls://www.example.com</em></span></li> </ul> <p class="simpara"> Internet Domain sockets expect a port number in addition to a target address. In the case of <span class="function"><a href="function.fsockopen.html" class="function">fsockopen()</a></span> this is specified in a second parameter and therefore does not impact the formatting of transport URL. With <span class="function"><a href="function.stream-socket-client.html" class="function">stream_socket_client()</a></span> and related functions as with traditional URLs however, the port number is specified as a suffix of the transport URL delimited by a colon. </p> <ul class="itemizedlist"> <li class="listitem"><span class="simpara"><em>tcp://127.0.0.1:80</em></span></li> <li class="listitem"><span class="simpara"><em>tcp://[fe80::1]:80</em></span></li> <li class="listitem"><span class="simpara"><em>tcp://www.example.com:80</em></span></li> </ul> <blockquote class="note"><p><strong class="note">Note</strong>: <strong>IPv6 numeric addresses with port numbers</strong><br /> <span class="simpara"> 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: <em>[fe80::1]</em>. This is to distinguish between the colons used in an IPv6 address and the colon used to delimit the portnumber. </span> </p></blockquote> <p class="simpara"> The <em>ssl://</em> and <em>tls://</em> transports (available only when openssl support is compiled into PHP) are extensions of the <em>tcp://</em> transport which include SSL encryption. Since PHP 4.3.0 OpenSSL support must be statically compiled into PHP, since PHP 5.0.0 it may be compiled as a module or statically. </p> <p class="simpara"> <em>ssl://</em> will attempt to negotiate an SSL V2, or SSL V3 connection depending on the capabilities and preferences of the remote host. <em>sslv2://</em> and <em>sslv3://</em> will select the SSL V2 or SSL V3 protocol explicitly. </p> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="transports.html">List of Supported Socket Transports</a></div> <div class="next" style="text-align: right; float: right;"><a href="transports.unix.html">Unix Domain: Unix and UDG</a></div> <div class="up"><a href="transports.html">List of Supported Socket Transports</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>