• Модуль: socialservices
  • Путь к файлу: ~/bitrix/modules/socialservices/classes/general/oauthtransport.php
  • Класс: CSocServOAuthTransport
  • Вызов: CSocServOAuthTransport::getDecodedJson
protected function getDecodedJson($url, $postData = null)
{
	$http = new BitrixMainWebHttpClient([
		'socketTimeout' => $this->httpTimeout,
		'streamTimeout' => $this->httpTimeout,
	]);

	if (isset($postData))
	{
		$postResult = $http->post($url, $postData);
	}
	else
	{
		$postResult = $http->get($url);
	}

	try
	{
		$decodedResult = BitrixMainWebJson::decode($postResult);
	}
	catch (BitrixMainArgumentException $e)
	{
		if (defined("BX_SOCIALSERVICES_ERROR_DEBUG"))
		{
			AddMessage2Log([
				'post_url' => $http->getEffectiveUrl(),
				'result_status' => $http->getStatus(),
				'result_error' => $http->getError(),
				'result_text' => $http->getResult(),
			], 'socialservices', 40);
		}
		$decodedResult = [];
	}

	return $decodedResult;
}