public function __construct($pageId, $secretKey)
 {
     ValidateFunc::checkNotNull($pageId, "Page id cann't be null");
     ValidateFunc::checkEmptyString($secretKey, "Secret key can't be empty");
     $this->pageId = $pageId;
     $this->secretKey = $secretKey;
 }
Exemplo n.º 2
0
 public static function buildRequestD($pageId, $act, $servlet, $timeStamp)
 {
     ValidateFunc::checkNotNull($pageId, "Page id can't be null");
     $client = new Client(CommonInfo::$DOMAIN . $servlet);
     $params = array(CommonInfo::$URL_ACT => $act, CommonInfo::$URL_PAGEID => $pageId, CommonInfo::$URL_TIMESTAMP => $timeStamp);
     $client->setDefaultOption('query', $params);
     return $client;
 }
 public function __construct($appId, $accessTok, $pageId)
 {
     ValidateFunc::checkNotNull($appId, "App id cann't be null");
     ValidateFunc::checkEmptyString($accessTok, "Access token cann't be empty");
     ValidateFunc::checkNotNull($pageId, "Page id cann't be null");
     $this->appId = $appId;
     $this->pageId = $pageId;
     $this->accessTok = $accessTok;
 }
 public function pushStickerFeed($message, $stickerId)
 {
     $timeStamp = time();
     $client = ZaloSdkHelper::buildRequestC($this->pageId, $message, CommonInfo::$ACT_STICKER, CommonInfo::$SER_SOCIAL, $timeStamp);
     //plus param
     ValidateFunc::checkNotNull($stickerId, "Sticker id can't be null");
     ZaloSdkHelper::addParamsHttpGet($client, CommonInfo::$URL_STICKERID, $stickerId);
     //build Mac
     $lstParams = array($this->pageId, $message, $stickerId, $timeStamp, $this->secretKey);
     $mac = ZaloSdkHelper::buildMacForAuthentication($lstParams);
     ZaloSdkHelper::addParamsHttpGet($client, CommonInfo::$URL_MAC, $mac);
     return ZaloSdkHelper::sendMessage($client);
 }
Exemplo n.º 5
0
 public function removeFanPageByPhoneNum($phoneNum)
 {
     $timeStamp = time();
     $client = ZaloSdkHelper::buildRequestD($this->pageId, CommonInfo::$ACT_REMOVE_PHONE, CommonInfo::$SER_FAN, $timeStamp);
     //plus param
     ValidateFunc::checkNotNull($phoneNum, "List phone numbers can't be null");
     ValidateFunc::checkListNotEmpty($phoneNum, "List phone numbers can't be empty");
     $strPhoneNums = $this->convertListToArray($phoneNum);
     ZaloSdkHelper::addParamsHttpGet($client, CommonInfo::$URL_UIDS, $strPhoneNums);
     //build Mac
     $lstParams = array($this->pageId, $strPhoneNums, $timeStamp, $this->secretKey);
     $mac = ZaloSdkHelper::buildMacForAuthentication($lstParams);
     ZaloSdkHelper::addParamsHttpGet($client, CommonInfo::$URL_MAC, $mac);
     return ZaloSdkHelper::sendRemoveFan($client);
 }
 public function getPageInfoOnbehaft()
 {
     $timeStamp = time();
     ValidateFunc::checkNotNull($this->pageId, "Page id can't be null");
     ValidateFunc::checkNotNull($this->appId, "App id can't be null");
     ValidateFunc::checkEmptyString($this->accessToken, "Access token can't be empty");
     if ($smsMsg == null) {
         $smsMsg = "";
     }
     $client = new Client(CommonInfo::$DOMAIN . CommonInfo::$SER_ONBEHALF);
     $params = array(CommonInfo::$URL_ACT => CommonInfo::$ACT_PROFILE, CommonInfo::$URL_PAGEID => $this->pageId, CommonInfo::$URL_APPID => $this->appId, CommonInfo::$URL_ACCESSTOK => $this->accessToken, CommonInfo::$URL_TIMESTAMP => $timeStamp);
     $client->setDefaultOption('query', $params);
     $profileResult = new ZaloProfileResult();
     $profileResult->setErr(-1);
     $profile = ZaloSdkHelper::sendQueryProfile($client);
     if ($profile != null) {
         $profileResult->setProfile($profile);
         $profileResult->setErr(0);
     }
     return $profileResult;
 }