afischoff/php-pardot-api

Pardot API(Salesforce.com公司)的API包装器。

dev-master 2013-11-22 19:17 UTC

This package is not auto-updated.

Last update: 2024-09-23 14:03:07 UTC


README

为Pardot RESTful API编写的PHP包装器

需求

  1. PHP 5.3.*
  2. 已安装cURL库
  3. 安装目录应为可写(非必需,但强烈推荐)

配置

  1. 在pardot_config.php文件中设置电子邮件、密码和user_key值
  2. 在pardot_config.php文件中设置调试模式和日志设置(可选)

用法

  1. 设置命名空间: use \Pardot\API as API;
  2. 使用3个主要请求函数进行请求
    1. doOperationById($object, $operation, $id = null, $parameters = null)
    2. doOperationByField($object, $operation, $field = null, $fieldValue = null, $parameters = null)
    3. queryObject($object, $parameters = null)

$object$operation 的值是类文件顶部引用的常量。


<?php
// namespace config
use \Pardot\API as API;

// get all prospects updated within the last 2 hours
$prospects = API::Instance()->queryObject(API::OBJ_PROSPECT, array('updated_after' => '2 hours ago'));
var_dump($prospects);

查看example.php文件以获取完整的用法示例。