nholdren/marketing-cloud-php-soap

用于与 Salesforce Marketing Cloud SOAP API 交互的 PHP 库

v1.1 2024-03-18 17:40 UTC

This package is auto-updated.

Last update: 2024-09-18 18:45:37 UTC


README

此包是用于 ExactTarget SOAP API 的经典 PHP 辅助库的更新版本。更新包括添加自 API 加入以来新增加的对象,以及支持使用 OAuth 令牌进行认证。

在此处可以找到使用 ExactTarget 旧库的示例:https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/php_code_samples.html

注意:Salesforce 中几乎所有 PHP 示例的类名都有拼写错误,例如 "Marketing Cloud_SoapClient(",在 "Marketing" 和 "Cloud" 之间有一个空格。

安装

Packagist

将包添加到 composer.json 中

{
    "require": {
           "nholdren/marketing-cloud-php-soap": "dev-main"
    }
}

然后运行 composer update

$ php composer.phar update nholdren/marketing-cloud-php-soap

或者

$ composer update nholdren/marketing-cloud-php-soap

使用

$wsdl = 'https:/YOUR-TENANT-ID.soap.marketingcloudapis.com/etframework.wsdl';

$client = new MarketingCloudSoapClient($wsdl, array('trace'=>1));

//Set username and password if still using this auth
$client->username = 'YOUR_USERNAME';
$client->password = 'YOUR_PASSWORD';

//Or pass your auth token instead
$client->username = '*';
$client->password = '*';
$client->authtoken = 'YOUR-AUTH-TOKEN';