PHP: check if SSL is being used

This method should also work on servers behind a load balancer: $isSecure = false;   if (isset($_SERVER[’HTTPS’]) && $_SERVER[’HTTPS’] == ‘on’) { $isSecure = true; } elseif (!empty($_SERVER[’HTTP_X_FORWARDED_PROTO’]) && $_SERVER[’HTTP_X_FORWARDED_PROTO’] == ‘https’ || !empty($_SERVER[’HTTP_X_FORWARDED_SSL’]) && $_SERVER[’HTTP_X_FORWARDED_SSL’] == ‘on’) {   $isSecure = true; }$isSecure = false; if (isset($_SERVER[‘HTTPS’]) && $_SERVER[‘HTTPS’] == ‘on’) { $isSecure =
Continue reading PHP: check if SSL is being used

Reflection in PHP

Reflection is generally defined as a program’s ability to inspect itself and modify its logic at execution time. In less technical terms, reflection is asking an object to tell you about its properties and methods, and altering those members (even private ones). In this lesson, we’ll dig into how this is accomplished, and when it
Continue reading Reflection in PHP

PHP: SOAP and WSS

$ns = ‘http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd’;   $token = new stdClass; $token->Username = new SoapVar(’username’, XSD_STRING, null, $ns, null, $ns); $token->Password = new SoapVar(’password’, XSD_STRING, null, $ns, null, $ns);   $wsec = new stdClass; $wsec->UsernameToken = new SoapVar($token, SOAP_ENC_OBJECT, null, $ns, null, $ns);   $header = new SoapHeader($ns, ‘Security’, $wsec, true);   // Soap environment $soapurl = ‘http://www.domain.com/webservice.wsdl’;
Continue reading PHP: SOAP and WSS