ImageAdExtension的Php示例 [英] Php Example for ImageAdExtension

查看:68
本文介绍了ImageAdExtension的Php示例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用ImageAdExtension这是我的代码

  $ imageAdExtension = new ImageAdExtension(); 
$ imageAdExtension-> AlternativeText ='Winter Collection';
$ imageAdExtension-> Description = $ ad ['description_1'];
$ imageAdExtension-> FinalUrls = array('https://www.b-yy.com/contact-us');
$ image = new Image();
$ image-> Data ='abc.jpg';
$ encodedImage = new SoapVar($ image,SOAP_ENC_OBJECT,'Image',$ proxy-> GetNamespace());
$ mediaResponse = $ this-> AddMedia($ proxy,$ accountId,$ encodedImage);

$ imageAdExtension-> ImageMediaIds = null;
$ encodedExtension = new SoapVar($ imageAdExtension,SOAP_ENC_OBJECT,'ImageAdExtension',$ proxy-> GetNamespace());
$ adExtensions [] = $ encodedExtension;


 

$ adExtensionResponse = $ this-> AddAdExtensions($ proxy,$ accountId,$ adExtensions);

但结果为null一个人告诉我我做错了什么。或者给我一个完整的工作示例ImageAdExtension with Media Ad for campaign

谢谢

解决方案

很好的问题。让我首先澄清一下
图像
数据应该是base64字符串,即不仅仅是媒体的文件名。


我们目前没有任何PHP样本,所以现在请检查
.NET示例
以查看添加媒体和图片扩展所需的步骤。我们也在
中触及它
原生广告
技术指南。如有任何跟进问题,请告知我们。


祝你好运,


埃里克


I am working on ImageAdExtension this is my code

$imageAdExtension = new ImageAdExtension();
$imageAdExtension->AlternativeText = 'Winter Collection';
$imageAdExtension->Description = $ad['description_1'];
$imageAdExtension->FinalUrls = array('https://www.b-yy.com/contact-us');
$image = new Image();
$image->Data = 'abc.jpg';
$encodedImage = new SoapVar($image, SOAP_ENC_OBJECT, 'Image', $proxy->GetNamespace());
$mediaResponse = $this->AddMedia($proxy, $accountId, $encodedImage);

$imageAdExtension->ImageMediaIds = null;
$encodedExtension = new SoapVar($imageAdExtension, SOAP_ENC_OBJECT, 'ImageAdExtension', $proxy->GetNamespace());
$adExtensions[] = $encodedExtension;

$adExtensionResponse = $this->AddAdExtensions($proxy, $accountId, $adExtensions);

but result is null any one tell me what i am doing wrong. or give me full working example of ImageAdExtension with Media Ad for campaign

Thanks

解决方案

Great question. Let me first clarify that the Image data should be a base64 string i.e. not just the filename of your media.

We do not have any PHP samples currently, so for now please check the .NET sample to see the steps needed to add media and image extensions. We also touch on it in the Native Ads technical guide. Any follow up questions please let me know.

Best regards,

Eric


这篇关于ImageAdExtension的Php示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆