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


PHP DfpUser類代碼示例

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


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

示例1: RunExample

/**
 * Run an example using the $user object.
 * @param string $user the user that contains the client ID and secret
 */
function RunExample(DfpUser $user)
{
    // Get the NetworkService.
    $networkService = $user->GetService('NetworkService');
    // Gets the current network.
    $network = $networkService->getCurrentNetwork();
    printf("Current network has network code %d and display name \"%s\".\n", $network->networkCode, $network->displayName);
}
開發者ID:rochmit10,項目名稱:googleads-php-lib,代碼行數:12,代碼來源:CreateDfpUserWithoutIniFile.php

示例2: FindRootAdUnit

/**
 * Finds the root ad unit for the user.
 * @param DfpUser $user the user to get the root ad unit for
 * @return the ad unit representing the root ad unit or <var>NULL</var> if one
 *     is not found.
 * @access private
 */
function FindRootAdUnit(DfpUser $user)
{
    // Get the InventoryService.
    $inventoryService = $user->GetService('InventoryService', 'v201208');
    // Create a statement to only select image creatives.
    $filterStatement = new Statement("WHERE parentId IS NULL LIMIT 1");
    // Get ad units by statement.
    $page = $inventoryService->getAdUnitsByStatement($filterStatement);
    if (isset($page->results)) {
        return $page->results[0];
    } else {
        return NULL;
    }
}
開發者ID:venkyanthony,項目名稱:google-api-dfp-php,代碼行數:21,代碼來源:GetInventoryTreeExample.php

示例3: error_reporting

 * @license    http://www.apache.org/licenses/LICENSE-2.0 Apache License,
 *             Version 2.0
 * @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 CustomFieldService.
    $customFieldService = $user->GetService('CustomFieldService', 'v201211');
    // Set the ID of the drop-down custom field to create options for.
    $customFieldId = "INSERT_DROP_DOWN_CUSTOM_FIELD_ID_HERE";
    // Create custom field options.
    $customFieldOption1 = new CustomFieldOption();
    $customFieldOption1->displayName = 'Approved';
    $customFieldOption1->customFieldId = $customFieldId;
    $customFieldOption2 = new CustomFieldOption();
    $customFieldOption2->displayName = 'Unapproved';
    $customFieldOption2->customFieldId = $customFieldId;
    // Create the custom targeting keys on the server.
    $customFieldOptions = $customFieldService->createCustomFieldOptions(array($customFieldOption1, $customFieldOption2));
開發者ID:venkyanthony,項目名稱:google-api-dfp-php,代碼行數:31,代碼來源:CreateCustomFieldOptions.php

示例4: error_reporting

 * @license    http://www.apache.org/licenses/LICENSE-2.0 Apache License,
 *             Version 2.0
 * @author     Adam Rogal <api.arogal@gmail.com>
 * @author     Eric Koleda <api.ekoleda@gmail.com>
 */
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';
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 InventoryService.
    $inventoryService = $user->GetService('InventoryService', 'v201108');
    // Create a statement to get all ad units.
    $filterStatement = new Statement("LIMIT 500");
    // Get ad units by statement.
    $page = $inventoryService->getAdUnitsByStatement($filterStatement);
    if (isset($page->results)) {
        $adUnits = $page->results;
        // Update each local ad unit object by enabling AdSense.
        foreach ($adUnits as $adUnit) {
            $adUnit->inheritedAdSenseSettings->value->adSenseEnabled = TRUE;
        }
        // Update the ad units on the server.
開發者ID:RayViljoen,項目名稱:Auto-DFP,代碼行數:31,代碼來源:UpdateAdUnitsExample.php

示例5: error_reporting

 *             Version 2.0
 * @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';
require_once 'Google/Api/Ads/Common/Util/MapUtils.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 CustomFieldService.
    $customFieldService = $user->GetService('CustomFieldService', 'v201308');
    // Get the LineItemService.
    $lineItemService = $user->GetService('LineItemService', 'v201308');
    // Set the IDs of the custom fields, custom field option, and line item.
    $customFieldId = "INSERT_CUSTOM_FIELD_ID_HERE";
    $dropDownCustomFieldId = "INSERT_DROP_DOWN_CUSTOM_FIELD_ID_HERE";
    $customFieldOptionId = "INSERT_CUSTOM_FIELD_OPTION_ID_HERE";
    $lineItemId = "INSERT_LINE_ITEM_ID_HERE";
    // Get the line item.
    $lineItem = $lineItemService->getLineItem($lineItemId);
    // Create custom field values.
    $customFieldValues = array();
開發者ID:venkyanthony,項目名稱:google-api-dfp-php,代碼行數:31,代碼來源:SetLineItemCustomFieldValue.php

示例6: error_reporting

 *             Version 2.0
 * @author     Eric Koleda
 * @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 LabelService.
    $labelService = $user->GetService('LabelService', 'v201405');
    // Create statement text to get all active labels.
    $filterStatementText = "WHERE isActive = true";
    $offset = 0;
    do {
        // Create statement to page through results.
        $filterStatement = new Statement($filterStatementText . " LIMIT 500 OFFSET " . $offset);
        // Get labels by statement.
        $page = $labelService->getLabelsByStatement($filterStatement);
        // Display results.
        $labelIds = array();
        if (isset($page->results)) {
開發者ID:planetfitnessnational,項目名稱:googleads-php-lib,代碼行數:31,代碼來源:DeactivateLabelsExample.php

示例7: error_reporting

 */
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 'Google/Api/Ads/Dfp/Util/v201608/StatementBuilder.php';
require_once dirname(__FILE__) . '/../../../Common/ExampleUtils.php';
// Set the ID of the custom targeting key to update.
$customTargetingKeyId = 'INSERT_CUSTOM_TARGETING_KEY_ID_HERE';
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 CustomTargetingService.
    $customTargetingService = $user->GetService('CustomTargetingService', 'v201608');
    // Create a statement to select a single custom targeting key by ID.
    $statementBuilder = new StatementBuilder();
    $statementBuilder->Where('id = :id')->OrderBy('id ASC')->Limit(1)->WithBindVariableValue('id', $customTargetingKeyId);
    // Default for total result set size.
    $totalResultSetSize = 0;
    // Get the custom targeting key.
    $page = $customTargetingService->getCustomTargetingKeysByStatement($statementBuilder->ToStatement());
    $customTargetingKey = $page->results[0];
    // Update the custom targeting key's display name.
    $customTargetingKey->displayName = 'New custom targeting key display name.';
    // Update the custom targeting key on the server.
開發者ID:googleads,項目名稱:googleads-php-lib,代碼行數:31,代碼來源:UpdateCustomTargetingKeys.php

示例8: error_reporting

 * @license    http://www.apache.org/licenses/LICENSE-2.0 Apache License,
 *             Version 2.0
 */
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 'Google/Api/Ads/Dfp/Util/v201602/StatementBuilder.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 CreativeService.
    $creativeService = $user->GetService('CreativeService', 'v201602');
    // Create a statement to select all creatives.
    $statementBuilder = new StatementBuilder();
    $statementBuilder->OrderBy('id ASC')->Limit(StatementBuilder::SUGGESTED_PAGE_LIMIT);
    // Default for total result set size.
    $totalResultSetSize = 0;
    do {
        // Get creatives by statement.
        $page = $creativeService->getCreativesByStatement($statementBuilder->ToStatement());
        // Display results.
        if (isset($page->results)) {
            $totalResultSetSize = $page->totalResultSetSize;
開發者ID:googleads,項目名稱:googleads-php-lib,代碼行數:31,代碼來源:GetAllCreatives.php

示例9: error_reporting

 * @license    http://www.apache.org/licenses/LICENSE-2.0 Apache License,
 *             Version 2.0
 * @author     Eric Koleda
 */
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 SuggestedAdUnitService.
    $suggestedAdUnitService = $user->GetService('SuggestedAdUnitService', 'v201405');
    // Set defaults for page and statement.
    $page = new SuggestedAdUnitPage();
    $filterStatement = new Statement();
    $offset = 0;
    do {
        // Create a statement to get all suggested ad units.
        $filterStatement->query = 'LIMIT 500 OFFSET ' . $offset;
        // Get creatives by statement.
        $page = $suggestedAdUnitService->getSuggestedAdUnitsByStatement($filterStatement);
        // Display results.
        if (isset($page->results)) {
開發者ID:planetfitnessnational,項目名稱:googleads-php-lib,代碼行數:31,代碼來源:GetAllSuggestedAdUnitsExample.php

示例10: error_reporting

 */
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 'Google/Api/Ads/Dfp/Util/v201505/StatementBuilder.php';
require_once dirname(__FILE__) . '/../../../Common/ExampleUtils.php';
// Set the ID of the creative wrapper to update.
$creativeWrapperId = 'INSERT_CREATIVE_WRAPPER_ID_HERE';
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 CreativeWrapperService.
    $creativeWrapperService = $user->GetService('CreativeWrapperService', 'v201505');
    // Create a statement to select a single creative wrapper by ID.
    $statementBuilder = new StatementBuilder();
    $statementBuilder->Where('id = :id')->OrderBy('id ASC')->Limit(1)->WithBindVariableValue('id', $creativeWrapperId);
    // Get the creative wrapper.
    $page = $creativeWrapperService->getCreativeWrappersByStatement($statementBuilder->ToStatement());
    $creativeWrapper = $page->results[0];
    // Update the creative wrapper ordering.
    $creativeWrapper->ordering = 'OUTER';
    // Update the creative wrapper on the server.
    $creativeWrappers = $creativeWrapperService->updateCreativeWrappers(array($creativeWrapper));
    foreach ($creativeWrappers as $updatedCreativeWrapper) {
開發者ID:rochmit10,項目名稱:googleads-php-lib,代碼行數:31,代碼來源:UpdateCreativeWrappers.php

示例11: error_reporting

 */
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 'Google/Api/Ads/Dfp/Util/v201602/StatementBuilder.php';
require_once dirname(__FILE__) . '/../../../Common/ExampleUtils.php';
// Set the rate card ID to filter base rates on.
$rateCardId = 'INSERT_RATE_CARD_ID_HERE';
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 BaseRateService.
    $baseRateService = $user->GetService('BaseRateService', 'v201602');
    // Create a statement to select only base rates belonging to a rate card.
    $statementBuilder = new StatementBuilder();
    $statementBuilder->Where('rateCardId = :rateCardId')->OrderBy('id ASC')->Limit(StatementBuilder::SUGGESTED_PAGE_LIMIT)->WithBindVariableValue('rateCardId', $rateCardId);
    // Default for total result set size.
    $totalResultSetSize = 0;
    do {
        // Get base rates by statement.
        $page = $baseRateService->getBaseRatesByStatement($statementBuilder->ToStatement());
        // Display results.
        if (isset($page->results)) {
            $totalResultSetSize = $page->totalResultSetSize;
開發者ID:googleads,項目名稱:googleads-php-lib,代碼行數:31,代碼來源:GetBaseRatesForRateCard.php

示例12: error_reporting

 *             Version 2.0
 */
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 'Google/Api/Ads/Dfp/Util/v201508/Pql.php';
require_once 'Google/Api/Ads/Dfp/Util/v201508/StatementBuilder.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 PublisherQueryLanguageService.
    $pqlService = $user->GetService('PublisherQueryLanguageService', 'v201508');
    // Create statement to select all line items.
    $statementBuilder = new StatementBuilder();
    $statementBuilder->Select('Id, BrowserName, MajorVersion, MinorVersion')->From('Browser')->OrderBy('BrowserName ASC')->Limit(StatementBuilder::SUGGESTED_PAGE_LIMIT);
    // Default for result sets.
    $resultSet = null;
    $combinedResultSet = null;
    $i = 0;
    do {
        // Get all browsers.
        $resultSet = $pqlService->select($statementBuilder->ToStatement());
        // Combine result sets with previous ones.
開發者ID:stevenmaguire,項目名稱:googleads-php-lib,代碼行數:31,代碼來源:GetAllBrowsers.php

示例13: error_reporting

 */
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__) . '/../../../../lib';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
require_once 'Google/Api/Ads/Dfp/Lib/DfpUser.php';
require_once 'Google/Api/Ads/Dfp/Util/v201508/StatementBuilder.php';
require_once dirname(__FILE__) . '/../../../Common/ExampleUtils.php';
// Set the ID of the line item to deactivate LICAs for.
$lineItemId = 'INSERT_LINE_ITEM_ID_HERE';
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 LineItemCreativeAssociationService.
    $licaService = $user->GetService('LineItemCreativeAssociationService', 'v201508');
    // Create a statement to select all LICAs for a line item.
    $statementBuilder = new StatementBuilder();
    $statementBuilder->Where('lineItemId = :lineItemId')->OrderBy('lineItemId ASC, creativeId ASC')->Limit(StatementBuilder::SUGGESTED_PAGE_LIMIT)->WithBindVariableValue('lineItemId', $lineItemId);
    // Default for total result set size.
    $totalResultSetSize = 0;
    do {
        // Get LICAs by statement.
        $page = $licaService->getLineItemCreativeAssociationsByStatement($statementBuilder->ToStatement());
        // Display results.
        if (isset($page->results)) {
            $totalResultSetSize = $page->totalResultSetSize;
開發者ID:sjakil,項目名稱:api-hub,代碼行數:31,代碼來源:DeactivateLicas.php

示例14: error_reporting

 * @license    http://www.apache.org/licenses/LICENSE-2.0 Apache License,
 *             Version 2.0
 */
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 'Google/Api/Ads/Dfp/Util/v201608/StatementBuilder.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 ReconciliationReportService.
    $reconciliationReportService = $user->GetService('ReconciliationReportService', 'v201608');
    // Create a statement to select reconciliation reports.
    $statementBuilder = new StatementBuilder();
    $statementBuilder->OrderBy('id ASC')->Limit(StatementBuilder::SUGGESTED_PAGE_LIMIT);
    // Default for total result set size.
    $totalResultSetSize = 0;
    do {
        // Get reconciliation reports by statement.
        $page = $reconciliationReportService->getReconciliationReportsByStatement($statementBuilder->ToStatement());
        // Display results.
        if (isset($page->results)) {
            $totalResultSetSize = $page->totalResultSetSize;
開發者ID:googleads,項目名稱:googleads-php-lib,代碼行數:31,代碼來源:GetAllReconciliationReports.php

示例15: error_reporting

 * @license    http://www.apache.org/licenses/LICENSE-2.0 Apache License,
 *             Version 2.0
 * @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 UserTeamAssociationService.
    $userTeamAssociationService = $user->GetService('UserTeamAssociationService', 'v201311');
    // Set the IDs of the user and team to get the association for.
    $userId = 'INSERT_USER_ID_HERE';
    $teamId = 'INSERT_TEAM_ID_HERE';
    // Get the user team association.
    $uta = $userTeamAssociationService->getUserTeamAssociation($teamId, $userId);
    // Display results.
    if (isset($uta)) {
        print 'User team association between user with ID "' . $uta->userId . '" and team with ID "' . $uta->teamId . "\" was found.\n";
    } else {
        print "No user team association found for this ID.\n";
    }
開發者ID:planetfitnessnational,項目名稱:googleads-php-lib,代碼行數:31,代碼來源:GetUserTeamAssociationExample.php


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