private function send()

in Aliyun/Log/Client.php [205:240]


    private function send($method, $project, $body, $resource, $params, $headers) {
        $credentials = null;
        try {
            $credentials = $this->credentialsProvider->getCredentials();
        } catch (Exception $ex) {
            throw new Aliyun_Log_Exception(
                'InvalidCredentials',
                'Fail to get credentials:' . $ex->getMessage(),
                ''
            );
        }

        if ($body) {
            $headers ['Content-Length'] = strlen ( $body );
            if(isset($headers ["x-log-bodyrawsize"])==false)
                $headers ["x-log-bodyrawsize"] = 0;
            $headers ['Content-MD5'] = Aliyun_Log_Util::calMD5 ( $body );
        } else {
            $headers ['Content-Length'] = 0;
            $headers ["x-log-bodyrawsize"] = 0;
            $headers ['Content-Type'] = ''; // If not set, http request will add automatically.
        }
        
        $headers ['x-log-apiversion'] = SLS_API_VERSION;
        $headers ['x-log-signaturemethod'] = 'hmac-sha1';
        if(strlen($credentials->getSecurityToken()) >0)
            $headers ['x-acs-security-token'] = $credentials->getSecurityToken();
        if(is_null($project))$headers ['Host'] = $this->logHost;
        else $headers ['Host'] = "$project.$this->logHost";
        $headers ['Date'] = $this->GetGMT ();
        $signature = Aliyun_Log_Util::getRequestAuthorization ( $method, $resource, $credentials->getAccessKeySecret(), $credentials->getSecurityToken(), $params, $headers );
        $headers ['Authorization'] = "LOG ".$credentials->getAccessKeyId().":$signature";
        
        $url = $this->buildUrl($project, $resource, $params);
        return $this->sendRequest ( $method, $url, $body, $headers );
    }