public function content() {
    $out = '';

    // XXX: The addition of the Content-Length check is a workaround
    // for an issue with using PHP Stream Wrappers to communicate with
    // Identity Service. Apparently, the remote does not provide
    // an EOF marker, and PHP is too dumb to truncate at Content-Length,
    // so we have to do it manually.
    $max = $this->header('Content-Length', NULL);
    if (isset($this->metadata['unread_bytes']) && isset($max)) {
      while (!feof($this->handle) && strlen($out) < $max) {
        $out .= fread($this->handle, 8192);
      }
    }
    else {
      // XXX: This works fine with CURL, but will not
      // work with PHP HTTP Stream Wrapper b/c the
      // wrapper has a bug that will cause this to
      // hang.
      $out = stream_get_contents($this->handle);
    }

    // Should we close or rewind?
    // Cannot rewind PHP HTTP streams.
    fclose($this->handle);
    //rewind($this->handle);

    return $out;
  }
public function content() {
    $out = '';

    // XXX: The addition of the Content-Length check is a workaround
    // for an issue with using PHP Stream Wrappers to communicate with
    // Identity Service. Apparently, the remote does not provide
    // an EOF marker, and PHP is too dumb to truncate at Content-Length,
    // so we have to do it manually.
    $max = $this->header('Content-Length', NULL);
    if (isset($this->metadata['unread_bytes']) && isset($max)) {
      while (!feof($this->handle) && strlen($out) < $max) {
        $out .= fread($this->handle, 8192);
      }
    }
    else {
      // XXX: This works fine with CURL, but will not
      // work with PHP HTTP Stream Wrapper b/c the
      // wrapper has a bug that will cause this to
      // hang.
      $out = stream_get_contents($this->handle);
    }

    // Should we close or rewind?
    // Cannot rewind PHP HTTP streams.
    fclose($this->handle);
    //rewind($this->handle);

    return $out;
  }
public function content ( ) { $ out = '' ; // XXX: The addition of the Content-Length check is a workaround // for an issue with using PHP Stream Wrappers to communicate with // Identity Service. Apparently, the remote does not provide // an EOF marker, and PHP is too dumb to truncate at Content-Length, // so we have to do it manually. $ max = $ this -> header ( 'Content-Length' , NULL ) ; if ( isset ( $ this -> metadata [ 'unread_bytes' ] ) && isset ( $ max ) ) { while ( ! feof ( $ this -> handle ) && strlen ( $ out ) < $ max ) { $ out .= fread ( $ this -> handle , 8192 ) ; } } else { // XXX: This works fine with CURL, but will not // work with PHP HTTP Stream Wrapper b/c the // wrapper has a bug that will cause this to // hang. $ out = stream_get_contents ( $ this -> handle ) ; } // Should we close or rewind? // Cannot rewind PHP HTTP streams. fclose ( $ this -> handle ) ; //rewind($this->handle); return $ out ; }
Get the contents of this response as a string.

This returns the body of the response (no HTTP headers)
as a single string.

@attention
IMPORTANT: This can only be called once. HTTP streams
handled by PHP's stream wrapper cannot be rewound, and
to keep memory usage low, we don't want to store the
entire content in a string.

@retval string
@return string
The contents of the response body.
Get the contents of this response as a string .