Skip Navigation Links.
展开 最小化

SpreadWebServcie.GetCampaignReport Method

下面的例子演示 如何獲取活動的綜合報告.

參數

參數

類型

描述

loginEmail

String

Spread賬號的登錄郵箱.

password

String

Spread賬號的密碼或者API Key.

campaignId

String

活動的ID.

返回結果

例子

string loginName = "Spread@reasonables.com";
string loginPassword = "Spread";

int campaignID = 12345;

//Create a SpreadWebService object and use its method.
SpreadWebService MySpread = new SpreadWebService();
CampaignReport result = MySpread.getCampaignReport(loginName, loginPassword, campaignID);

Dim loginName As String = "Spread@reasonables.com"
Dim loginPassword As String = "Spread"

Dim campaignID As Integer = 123456

'Create a SpreadWebService object and use its method.
Dim MySpread As New SpreadWebService
Dim result As CampaignReport = MySpread.getCampaignReport(loginName, loginPassword, campaignID)

        /**
     * @name     obj2arr
     * @function array of object
    **/
    public function obj2arr( $obj ){
        $ret = array();
        foreach( $obj as $key => $value ){
            if( gettype( $value ) == 'array' || gettype( $value ) == 'object' ){
                $ret[$key] = obj2arr( $value );
            }
            else{
                $ret[$key] = $value;
            }
        }
        return $ret;
    }

   /**
     * @name     getReport
     * @function get the basic report of campaign
     * @param
     *  cnpId    Campaign Id(stdClass Object)
     * @return
	 *  report   the basic report of campaing
    **/
    public function getReport( $cnpId ){
        if( empty( $cnpId ) ){
            return -1;
        }
        $cnpIdArr = $this -> obj2arr($loginEmail,$password,$cnpId );
        $idVal = array_pop( $cnpIdArr );
        $reportArr = array(
            'loginEmail'    => $loginEmail,
            'password'      => $password,
            'campaignID'    => $idVal
        );
        $Client=new SoapClient("http://service.rspread.com/Service.asmx?WSDL");
        $report = $Client -> getCampaignReport( $reportArr );
        if( empty( $report ) ){
            return -2;
        }
        return $report;
    }
}
         
No sample.