You are here

function soap_transport_http::parseCookie in Salesforce Suite 5

Same name in this branch
  1. 5 includes/nusoap.php \soap_transport_http::parseCookie()
  2. 5 includes/nusoap.orig.php \soap_transport_http::parseCookie()
Same name and namespace in other branches
  1. 5.2 includes/nusoap.php \soap_transport_http::parseCookie()
  2. 5.2 includes/nusoap.orig.php \soap_transport_http::parseCookie()
2 calls to soap_transport_http::parseCookie()
soap_transport_http::getResponse in includes/nusoap.php
soap_transport_http::getResponse in includes/nusoap.orig.php

File

includes/nusoap.php, line 2924

Class

soap_transport_http
transport class for sending/receiving data via HTTP and HTTPS NOTE: PHP must be compiled with the CURL extension for HTTPS support

Code

function parseCookie($cookie_str) {
  $cookie_str = str_replace('; ', ';', $cookie_str) . ';';
  $data = split(';', $cookie_str);
  $value_str = $data[0];
  $cookie_param = 'domain=';
  $start = strpos($cookie_str, $cookie_param);
  if ($start > 0) {
    $domain = substr($cookie_str, $start + strlen($cookie_param));
    $domain = substr($domain, 0, strpos($domain, ';'));
  }
  else {
    $domain = '';
  }
  $cookie_param = 'expires=';
  $start = strpos($cookie_str, $cookie_param);
  if ($start > 0) {
    $expires = substr($cookie_str, $start + strlen($cookie_param));
    $expires = substr($expires, 0, strpos($expires, ';'));
  }
  else {
    $expires = '';
  }
  $cookie_param = 'path=';
  $start = strpos($cookie_str, $cookie_param);
  if ($start > 0) {
    $path = substr($cookie_str, $start + strlen($cookie_param));
    $path = substr($path, 0, strpos($path, ';'));
  }
  else {
    $path = '/';
  }
  $cookie_param = ';secure;';
  if (strpos($cookie_str, $cookie_param) !== FALSE) {
    $secure = true;
  }
  else {
    $secure = false;
  }
  $sep_pos = strpos($value_str, '=');
  if ($sep_pos) {
    $name = substr($value_str, 0, $sep_pos);
    $value = substr($value_str, $sep_pos + 1);
    $cookie = array(
      'name' => $name,
      'value' => $value,
      'domain' => $domain,
      'path' => $path,
      'expires' => $expires,
      'secure' => $secure,
    );
    return $cookie;
  }
  return false;
}