Htaccess    html   Php    javascript   Asp   css    maths  Past Questions  Practice Tests Online

stream socket enable crypto function syntax tag tutorial 2013 Donate at flattr Flattr this





Alert! Connect with 10,000 Chating Online. Join Now

Php stream socket enable crypto () function

Write your php code

 
<?php ?>

Php Result


Your code below



(no version information, might be only in CVS)

stream_socket_enable_crypto --  Turns encryption on/off on an already connected socket

Syntax

mixed stream_socket_enable_crypto ( resource stream, bool enable [, int crypto_type [, resource session_stream]] )

When called with the crypto_type parameter, stream_socket_enable_crypto() will setup encryption on the stream using the specified method.

Valid values for crypto_type

  • STREAM_CRYPTO_METHOD_SSLv2_CLIENT

  • STREAM_CRYPTO_METHOD_SSLv3_CLIENT

  • STREAM_CRYPTO_METHOD_SSLv23_CLIENT

  • STREAM_CRYPTO_METHOD_TLS_CLIENT

  • STREAM_CRYPTO_METHOD_SSLv2_SERVER

  • STREAM_CRYPTO_METHOD_SSLv3_SERVER

  • STREAM_CRYPTO_METHOD_SSLv23_SERVER

  • STREAM_CRYPTO_METHOD_TLS_SERVER

Once the crypto settings are established, cryptography can be turned on and off dynamically by passing TRUE or FALSE in the enable parameter.

If this stream should be seeded with settings from an already established crypto enabled stream, pass that stream's resource variable in the fourth parameter.

Returns TRUE on success, FALSE if negotiation has failed or 0 if there isn't enough data and you should try again (only for non-blocking sockets).

Example 1. stream_socket_enable_crypto() Example

<?php
$fp
= stream_socket_client("tcp://myproto.example.com:31337", $errno, $errstr, 30);
if (!
$fp) {
  die(
"Unable to connect: $errstr ($errno)");
}
/* Turn on encryption for login phase */
stream_socket_enable_crypto($fp, true, STREAM_CRYPTO_METHOD_SSLv23_CLIENT);
fwrite($fp, "USER god\r\n");
fwrite($fp, "PASS secret\r\n");
/* Turn off encryption for the rest */
stream_socket_enable_crypto($fp, false);
while (
$motd = fgets($fp)) {
  echo
$motd;
}
fclose($fp);
?>

Reference LXXXIX, OpenSSL Functions, and Appendix N

Php stream socket enable crypto Function syntax tag

stream socket enable crypto php code on this is provided for your study purpose, it will guide you to know how create and design a website using php. use it to practice and train your self online



Php stream socket enable crypto syntax tutorial

php tutorial guide and code design are for easy learning and programming. The code practice section provided at the top is for practising of this syntax. Use the code section up to practice your php programming online. Learning php is very easy, all you need is to use the examples on this site and practice them to perfect your skills.


Function index

Variables

Expressions

Operators

Control-Structures

Cookies

Array

Date & Time

Directory function

File

Image

Operators

Form data handling

Mathematics operators

Mail

Php Mysql

Network Functions

Strings

php tutorial guides,functions, classes, code examples and tags for creating simple dynamic site to mysql database driven sites
 
 
Htaccess    html   Php    javascript   Asp   css    maths  Past Questions  Practice Tests Online