コード例 #1
0
 /**
  * @param AdCenterUser $user AdCenterUser Object
  * @param string $wsdl WSDL for the service
  * @param string $namespace
  */
 public function __construct(AdCenterUser $user, $wsdl, $namespace)
 {
     // Set the user
     $this->_user = $user;
     // Set the namespace
     $this->_namespace = $namespace;
     // Set the input headers which are required for every adCenter SOAP call
     $this->_requiredInputHeaders = array(new SoapHeader($this->GetNamespace(), "UserName", $this->_user->GetUserName()), new SoapHeader($this->GetNamespace(), "Password", $this->_user->GetPassword()), new SoapHeader($this->GetNamespace(), "DeveloperToken", $this->_user->GetDeveloperToken()), new SoapHeader($this->GetNamespace(), "CustomerAccountId", $this->_user->GetCustomerAccountId()));
     // Default class map (these are shared over all)
     $defaultClassMap = array("Date" => "AdCenter_Date", "ApplicationFault" => "AdCenter_ApplicationFault", "AdApiFaultDetail" => "AdCenter_AdApiFaultDetail", "AdApiError" => "AdCenter_AdApiError", "ApiFault" => "AdCenter_ApiFault", "BatchError" => "AdCenter_BatchError", "OperationError" => "AdCenter_OperationError");
     // Map our custom classes
     $classMap = array_merge($defaultClassMap, $this->GetClassMap());
     // Call the parent SoapClient constructor
     parent::__construct($wsdl, array("trace" => true, "classmap" => $classMap, "features" => SOAP_SINGLE_ELEMENT_ARRAYS));
 }
コード例 #2
0
 * the request and then download the report.
 *
 * @author Brandon Parise <*****@*****.**>
 * @package adCenter-PHP-API-Client
 * @subpackage Examples
 * @since 2010-12-20
 */
// Define where the adCenter API Client ./lib folder
define("ADCENTER_API_CLIENT_DIR", "/path/to/adCenter-PHP-API-Client/lib");
// Authentication details.
$username = "";
$password = "";
$developerToken = "";
// AdCenterUser class
require ADCENTER_API_CLIENT_DIR . "/AdCenterUser.php";
$user = new AdCenterUser($username, $password, $developerToken);
try {
    // Get the Administration Service
    $ReportingService = $user->GetReportingService();
    // Define the columns we want for the report
    $columns = array("AccountId", "TimePeriod", "Keyword", "Clicks", "Ctr", "AverageCpc", "Spend");
    // Create our Report Request
    $KeywordPerformanceReportRequest = new AdCenter_KeywordPerformanceReportRequest();
    $KeywordPerformanceReportRequest->Aggregation = AdCenter_ReportAggregation::Daily;
    $KeywordPerformanceReportRequest->Time = new AdCenter_ReportTime(null, null, AdCenter_ReportTimePeriod::Today);
    $KeywordPerformanceReportRequest->Columns = $columns;
    // Submit the Report Request and get back the ID
    $ReportRequestId = $ReportingService->SubmitGenerateReport($KeywordPerformanceReportRequest);
    var_dump($ReportRequestId);
    // Start the polling loop
    $waitSeconds = 3;
コード例 #3
0
 * then provide the total quota used.
 *
 * @author Brandon Parise <*****@*****.**>
 * @package adCenter-PHP-API-Client
 * @subpackage Examples
 * @since 2010-12-20
 */
// Define where the adCenter API Client ./lib folder
define("ADCENTER_API_CLIENT_DIR", "/path/to/adCenter-PHP-API-Client/lib");
// Authentication details.
$username = "";
$password = "";
$developerToken = "";
// AdCenterUser class
require ADCENTER_API_CLIENT_DIR . "/AdCenterUser.php";
$user = new AdCenterUser($username, $password, $developerToken);
try {
    // 	Get the Administration Service
    $AdministrationService = $user->GetAdministrationService();
    // Fetch our Assigned Quota
    $assignedQuota = $AdministrationService->GetAssignedQuota();
    // Fetch our Remaining Quota
    $remainingQuota = $AdministrationService->GetRemainingQuota();
    echo "Assigned Quota: ";
    var_dump($assignedQuota);
    echo "Remaining Quota: ";
    var_dump($remainingQuota);
    // Use them to compute how much of the quota has been used
    echo "Quota Used: ";
    var_dump($assignedQuota - $remainingQuota);
} catch (SoapFault $f) {