@param array $data
@param array $headers

@throws Exception

@return array|string
546568
public function copy(array $data, array $headers = [])
    {
        $url = $this->url('addons/copy');

        return $this->post($url, $data, $headers);
    }
357818
function parseRequest($headers, $data)
    {
        $this->debug('Entering parseRequest() for payload of length ' . strlen($data) . ' and type of ' . $headers['content-type']);
        $this->requestAttachments = [];
        if (strstr($headers['content-type'], 'multipart/related')) {
            $this->debug('Decode multipart/related');
            $input = '';
            foreach ($headers as $k => $v) {
                $input .= "$k: $v\r\n";
            }
            $params['input']          = $input . "\r\n" . $data;
            $params['include_bodies'] = TRUE;
            $params['decode_bodies']  = TRUE;
            $params['decode_headers'] = TRUE;

            $structure = Mail_mimeDecode::decode($params);

            foreach ($structure->parts as $part) {
                if (!isset($part->disposition) && (strstr($part->headers['content-type'], 'text/xml'))) {
                    $this->debug('Have root part of type ' . $part->headers['content-type']);
                    $return = parent::parseRequest($part->headers, $part->body);
                } else {
                    $this->debug('Have an attachment of type ' . $part->headers['content-type']);
                    $info['data']               = $part->body;
                    $info['filename']           = isset($part->d_parameters['filename']) ? $part->d_parameters['filename'] : '';
                    $info['contenttype']        = $part->headers['content-type'];
                    $info['cid']                = $part->headers['content-id'];
                    $this->requestAttachments[] = $info;
                }
            }

            if (isset($return)) {
                return $return;
            }

            $this->setError('No root part found in multipart/related content');

            return;
        }
        $this->debug('Not multipart/related');

        return parent::parseRequest($headers, $data);
    }
1171525
public function cancel(string $id, array $data, array $headers = [])
    {
        $url = $this->url('subscriptions/%s/cancel', $id);

        return $this->post($url, $data, $headers);
    }
649145
public function get($url, array $data = [], array $headers = [])
    {
        if ($data) {
            $url .= '?' . http_build_query($data);
        }
        return $this->sendRequest('GET', $url, $headers);
    }
1014390
public function createCard(array $data, array $headers = [])
    {
        $url = $this->url('payment_sources/create_card');

        return $this->post($url, $data, $headers);
    }
502965
protected function request($url, $data, array $headers = array())
    {
        $ch = curl_init();

        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_POST, true);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));

        curl_exec($ch);
        $statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
        curl_close($ch);

        return floor($statusCode / 100) == 2;
    }
572009
public function deferredRevenue(array $data = [], array $headers = [])
    {
        $url = $this->url('exports/deferred_revenue');

        return $this->post($url, $data, $headers);
    }
102201
public function load(array $headers = [])
    {
        $data = $this->getApi()->getConfiguration($headers);

        return $this->getFactory()->create($data);
    }
353348
public function create($service, $headers = null, $data = null)
	{
		return $this->post($service, $headers, $data);
	}
279450
public function respondWithData(array $data)
    {

        $responseData = $this->getResponseStructure(true, $data, '');
        $response = new JsonResponse($responseData, $this->getStatusCode(), $this->getHeaders());
        return $response;
    }
190211
public function createRequestFromArray(array $headers): GenericRequest
    {
        $upperCaseHeaders = [];

        foreach ($headers as $header => $value) {
            $upperCaseHeader = mb_strtoupper(str_replace('-', '_', $header));

            if (0 !== mb_strpos($upperCaseHeader, 'HTTP_')) {
                $upperCaseHeader = 'HTTP_' . $upperCaseHeader;
            }

            if (!HeaderSecurity::isValid($value)) {
                $value = $this->filterHeader($value);
            }

            $upperCaseHeaders[$upperCaseHeader] = $value;
        }

        $message = ServerRequestFactory::fromGlobals($upperCaseHeaders);

        return $this->createRequestFromPsr7Message($message);
    }
1225164
public function write( $data, $headers = array() )
	{
		$output = array();
		if( $headers )
		{
			$output[] = implode( $this->separator, $headers );
		}
		foreach( $data as $line )
		{
			foreach( $line as $nr => $value )														//  iterate line values
				if( substr_count( $value, $this->separator ) > 0 )									//  separator found in value
					if( substr( $value, 0, 1 ).substr( $value, -1 ) != '""' )						//  value is not masked
						$line[$nr]	= '"'.addslashes( $value ).'"';									//  mask value
			$line = implode( $this->separator, $line );
			$output[] = $line;
		}
		$file	= new FS_File_Writer( $this->fileName );
		return $file->writeArray( $output );
	}
107997
private function send($url, array $data = [], array $headers = [])
    {
        // Set incoming parameters as cURL options
        $this->setUrl($url);
        $this->setData($data);
        $this->setHeaders($headers);

        return $this->executeCurlRequest();
    }
841373
private function combineSheetDataWithHeadings(array $data, GSuiteHandlingSpecificationsInterface $gSuiteHandlingSpecifications): array
    {
        $headings = null;
        $outputData = [];

        foreach ($data as $row) {
            if (true === $this->isEmptyRow($row)) {
                continue;
            }

            // Skip non-headings rows until we find headings
            if (true === empty($headings) && false === $gSuiteHandlingSpecifications->isHeadingsRow($row)) {
                continue;
            }

            if (true === empty($headings) && true === $gSuiteHandlingSpecifications->isHeadingsRow($row)) {
                $headings = $row;
                continue;
            }

            // Slice first N elements from headings if row doesn't have values for ending columns
            $outputData[] = array_combine(
                array_slice($headings, 0, count($row)),
                $row
            );
        }

        return $outputData;
    }
538231
public function post($url, $data = '', array $headers = [])
    {
        return $this->executor->execute(
            $url,
            [
                CURLOPT_POST => true,
                CURLOPT_HTTPHEADER => $headers,
                CURLOPT_POSTFIELDS => $data,
            ]
        );
    }
729807
public function collectNow(array $data = [], array $headers = [])
    {
        $url = $this->url('hosted_pages/collect_now');

        return $this->post($url, $data, $headers);
    }
468428
protected function HLUpdate(array $data)
    {
        $return = [];
        if (empty($data['NAME'])) {
            throw new Exception('You must set NAME');
        }
        if ($id = $this->HLGetIdByCode($data['NAME'])) {
            $arLoad = $data;
            unset($arLoad['LANGS'], $arLoad['RIGHTS'], $arLoad['NAME']);
            if ($arLoad) {
                $result = HighloadBlockTable::update($id, $arLoad);
                if ($result->isSuccess()) {
                    if (!empty($data['LANGS'])) {
                        $this->HLSetLangs($id, $data['LANGS']);
                    }
                    if (!empty($data['RIGHTS'])) {
                        $this->HLSetRights($id, $data['RIGHTS']);
                    }
                    $return[] = "Update {$data['NAME']} ({$id}) highload block";
                } else {
                    throw new Exception("Can't update {$data['NAME']} ({$id}) highload block: " . implode(', ', $result->getErrorMessages()));
                }
            } elseif (!empty($data['RIGHTS'])) {
                $this->HLSetRights($id, $data['RIGHTS']);
            } elseif (!empty($data['LANGS'])) {
                $this->HLSetLangs($id, $data['LANGS']);
            }
        } else {
            throw new Exception("Hl entity with name {$data['NAME']} does not exist");
        }

        return $return;
    }