Skip Navigation Links.
展开 最小化

SpreadWebServcie.GetCampaignReport Method

The following examples demonstrate how to get campaign general report.

Parameters

Parameter

Type

Description

loginEmail

String

The login email of your Spread account.

password

String

The password of your Spread account or API Key which you can retrieve from your Spread account (My account=> Settings).

campaignId

String

The ID of the email campaign.

Return Value

Example

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.