You are here

function soap_transport_http::buildPayload in Salesforce Suite 5.2

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

File

includes/nusoap.php, line 2472

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 buildPayload($data, $cookie_str = '') {

  // add content-length header
  $this->outgoing_headers['Content-Length'] = strlen($data);
  $this
    ->debug('set Content-Length: ' . $this->outgoing_headers['Content-Length']);

  // start building outgoing payload:
  $req = "{$this->request_method} {$this->uri} HTTP/{$this->protocol_version}";
  $this
    ->debug("HTTP request: {$req}");
  $this->outgoing_payload = "{$req}\r\n";

  // loop thru headers, serializing
  foreach ($this->outgoing_headers as $k => $v) {
    $hdr = $k . ': ' . $v;
    $this
      ->debug("HTTP header: {$hdr}");
    $this->outgoing_payload .= "{$hdr}\r\n";
  }

  // add any cookies
  if ($cookie_str != '') {
    $hdr = 'Cookie: ' . $cookie_str;
    $this
      ->debug("HTTP header: {$hdr}");
    $this->outgoing_payload .= "{$hdr}\r\n";
  }

  // header/body separator
  $this->outgoing_payload .= "\r\n";

  // add data
  $this->outgoing_payload .= $data;
}