• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/tradingplatform/ebay/api/caller.php
  • Класс: BitrixSaleTradingPlatformEbayApiCaller
  • Вызов: Caller::sendRequest
public function sendRequest($callName, $data, $devId = "", $apiAppId = "", $certId = "")
{
	if($callName == '')
		throw new ArgumentNullException("callName");

	$this->http->setHeader("X-EBAY-API-CALL-NAME", $callName);

	if($devId <> '')
		$this->http->setHeader("X-EBAY-API-DEV-NAME", $devId);

	if($apiAppId <> '')
		$this->http->setHeader("X-EBAY-API-APP-NAME", $apiAppId);

	if($certId <> '')
		$this->http->setHeader("X-EBAY-API-CERT-NAME", $certId);


	if(mb_strtolower(SITE_CHARSET) != 'utf-8')
		$data = Encoding::convertEncodingArray($data, SITE_CHARSET, 'UTF-8');

	$result = @$this->http->post($this->apiUrl, $data);
	$errors = $this->http->getError();

	if (!$result && !empty($errors))
	{
		$strError = "";

		foreach($errors as $errorCode => $errMes)
			$strError .= $errorCode.": ".$errMes;

		throw new SystemException($strError);
	}
	else
	{
		$status = $this->http->getStatus();

		if ($status != 200)
			throw new SystemException(sprintf('HTTP error code: %d', $status));
	}

	return $result;
}