當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DfpUser::LogDefaults方法代碼示例

本文整理匯總了PHP中DfpUser::LogDefaults方法的典型用法代碼示例。如果您正苦於以下問題:PHP DfpUser::LogDefaults方法的具體用法?PHP DfpUser::LogDefaults怎麽用?PHP DfpUser::LogDefaults使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在DfpUser的用法示例。


在下文中一共展示了DfpUser::LogDefaults方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: dfp

 public function dfp()
 {
     App::import("Vendor", "DFPUser", array("file" => "Google/Api/Ads/Dfp/Lib/DfpUser.php"));
     $path = dirname(__FILE__) . '/../../..';
     set_include_path(get_include_path() . PATH_SEPARATOR . $path);
     try {
         // Get DfpUser from credentials in "../auth.ini"
         // relative to the DfpUser.php file's directory.
         $user = new DfpUser();
         // Log SOAP XML request and response.
         $user->LogDefaults();
         // Get the CreativeService.
         $creativeService = $user->GetCreativeService('v201104');
         // Set the ID of the advertiser (company) that all creatives will be
         // assigned to.
         $advertiserId = (double) '1917';
         // Create an array to store local image creative objects.
         $imageCreatives = array();
         for ($i = 0; $i < 5; $i++) {
             $imageCreative = new ImageCreative();
             $imageCreative->name = 'Image creative #' . $i;
             $imageCreative->advertiserId = $advertiserId;
             $imageCreative->destinationUrl = 'http://google.com';
             $imageCreative->imageName = 'image.jpg';
             $imageCreative->imageByteArray = MediaUtils::GetBase64Data('http://www.google.com/intl/en/adwords/' . 'select/images/samples/inline.jpg');
             $imageCreative->size = new Size(300, 250);
             $imageCreatives[] = $imageCreative;
         }
         // Create the image creatives on the server.
         $imageCreatives = $creativeService->createCreatives($imageCreatives);
         // Display results.
         if (isset($imageCreatives)) {
             foreach ($imageCreatives as $creative) {
                 // Use instanceof to determine what type of creative was returned.
                 if ($creative instanceof ImageCreative) {
                     print 'An image creative with ID "' . $creative->id . '", name "' . $creative->name . '", and size {' . $creative->size->width . ', ' . $creative->size->height . "} was created and\n" . ' can be previewed at: ' . $creative->previewUrl . "\n";
                 } else {
                     print 'A creative with ID "' . $creative->id . '", name "' . $creative->name . '", and type "' . $creative->CreativeType . "\" was created.\n";
                 }
             }
         } else {
             print "No creatives created.\n";
         }
     } catch (Exception $e) {
         print $e->getMessage() . "\n";
     }
 }
開發者ID:josephbergdoll,項目名稱:berrics,代碼行數:47,代碼來源:TesterController.php

示例2: dirname

 * @author     Paul Rashidi
 */
error_reporting(E_STRICT | E_ALL);
// You can set the include path to src directory or reference
// DfpUser.php directly via require_once.
// $path = '/path/to/dfp_api_php_lib/src';
$path = dirname(__FILE__) . '/../../../../src';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
require_once 'Google/Api/Ads/Dfp/Lib/DfpUser.php';
require_once dirname(__FILE__) . '/../../../Common/ExampleUtils.php';
try {
    // Get DfpUser from credentials in "../auth.ini"
    // relative to the DfpUser.php file's directory.
    $user = new DfpUser();
    // Log SOAP XML request and response.
    $user->LogDefaults();
    // Get the TeamService.
    $teamService = $user->GetService('TeamService', 'v201408');
    // Set defaults for page and statement.
    $page = new TeamPage();
    $filterStatement = new Statement();
    $offset = 0;
    do {
        // Create a statement to get all teams.
        $filterStatement->query = 'LIMIT 500 OFFSET ' . $offset;
        // Get teams by statement.
        $page = $teamService->getTeamsByStatement($filterStatement);
        // Display results.
        if (isset($page->results)) {
            $i = $page->startIndex;
            foreach ($page->results as $team) {
開發者ID:planetfitnessnational,項目名稱:googleads-php-lib,代碼行數:31,代碼來源:GetAllTeams.php

示例3: checkReportStatus

 public function checkReportStatus($id)
 {
     $path = dirname(__FILE__) . '/dfp/src';
     set_include_path(get_include_path() . PATH_SEPARATOR . $path);
     require_once 'Google/Api/Ads/Dfp/Lib/DfpUser.php';
     try {
         // Get DfpUser from credentials in "../auth.ini"
         // relative to the DfpUser.php file's directory.
         $user = new DfpUser();
         // Log SOAP XML request and response.
         $user->LogDefaults();
         // Set the ID of the completed report.
         $reportJobId = (double) $id;
         $reportService = $user->GetReportService('v201108');
         $reportJob = $reportService->getReportJob($reportJobId);
         if ($reportJob->reportJobStatus == 'COMPLETED') {
             return true;
         } else {
             return false;
         }
         //  printf("Report downloaded to file '%s'.\n", $filePath);
     } catch (Exception $e) {
         die($e->getMessage());
     }
 }
開發者ID:josephbergdoll,項目名稱:berrics,代碼行數:25,代碼來源:DfpApi.php


注:本文中的DfpUser::LogDefaults方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。