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