• Модуль: socialservices
  • Путь к файлу: ~/bitrix/modules/socialservices/classes/general/odnoklassniki.php
  • Класс: COdnoklassnikiInterface
  • Вызов: COdnoklassnikiInterface::SendFeed
public function SendFeed($socServUserId, $message, $getNewToken=true)
{
	if(!$this->access_token || intval($this->userId) < 1)
		self::SetOauthKeys($socServUserId);
	if(!defined("BX_UTF"))
		$message = CharsetConverter::ConvertCharset($message, LANG_CHARSET, "utf-8");
	$this->sign = mb_strtolower(md5('application_key='.$this->appKey.'method=users.setStatusstatus='.$message.md5($this->access_token.$this->appSecret)));
	$result = CHTTP::sGetHeader(self::CONTACTS_URL."?method=users.setStatus&application_key=".$this->appKey."&access_token=".$this->access_token."&sig=".$this->sign."&status=".urlencode($message), array(), $this->httpTimeout);

	if(!defined("BX_UTF"))
		$result = CharsetConverter::ConvertCharset($result, "utf-8", LANG_CHARSET);
	$arResult = CUtil::JsObjectToPhp($result);
	if($getNewToken === true && isset($arResult["error_code"]) && $arResult["error_code"] == "102")
		{
			$newToken = self::RefreshToken($socServUserId);
			if($newToken === true)
				self::SendFeed($socServUserId, $message, false);
			else
				return false;
		}
	return $arResult;
}