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.