API_ID .$this->APIKEY . $time); return base64_encode($this->ownerId. ','. $this->API_ID. ',' .$time. ',' . $sign); } public function send($body) { $params['pageId'] = $body['pageId']; $params['ownerId'] = $this->ownerId; $params['ip'] = $_SERVER['REMOTE_ADDR']; $params['tid'] = $body['tid']; $params['lbid'] = $body['lbid']; $params['transformType'] = 101; $token = $this->create_token(); $header = [ 'Content-Type: application/json', "Authorization:Bearer {$token}" ]; $params = json_encode($params); $resp = http_post_data($this->url, $params, $header, $net_errno); if (empty($resp)) { Log::record("sapi send neterr {$net_errno}", Log::ERR); return false; } else { Log::record($resp, Log::DEBUG); $resp = json_decode($resp, true); if ($resp['code'] === 0) { return true; } else { Log::record("sapi send err {$resp['msg']}", Log::ERR); return false; } } } }