本文整理汇总了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);
}
示例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;
}
}
示例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));
示例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.
示例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();
示例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)) {
示例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.
示例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;
示例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)) {
示例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) {
示例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;
示例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.
示例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;
示例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;
示例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";
}