PHP code example of cyber-duck / pardot-api

1. Go to this page and download the library: Download cyber-duck/pardot-api library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

cyber-duck / pardot-api example snippets


use CyberDuck\PardotApi\PardotApi;

$pardot = new PardotApi(
    'EMAIL',
    'PASSWORD',
    'CLIENT_ID',
    'CLIENT_SECRET',
    'BUSINESS_UNIT_ID',
);

$result = $pardot->request('campaign', 'read/id/1');

$result = $pardot->request('campaign', 'query', ['created_after' => 'today']);

$pardot->account()->read(); // retrieves current account information

$pardot->campaign()->query([...]); // queries and returns a filtered list
$pardot->campaign()->create([...]); // creates an object using passed array data
$pardot->campaign()->read(1); // queries an object by ID
$pardot->campaign()->update(1, [...]); // updates an object by ID using passed array data 

$pardot->customField()->query([...]); // queries and returns a filtered list
$pardot->customField()->create([...]); // creates an object using passed array data
$pardot->customField()->read(1); // queries an object by ID
$pardot->customField()->update(1, [...]); // updates an object by ID using passed array data 
$pardot->customField()->delete(1); // deletes an object by ID

$pardot->customRedirect()->query([...]); // queries and returns a filtered list
$pardot->customRedirect()->read(1); // queries an object by ID

$pardot->dynamicContent()->query([...]); // queries and returns a filtered list
$pardot->dynamicContent()->read(1); // queries an object by ID

$pardot->emailClick()->query([...]); // queries and returns a filtered list

$pardot->email()->read(1); // queries an object by ID
$pardot->email()->stats(1); // Returns the statistical data for the list email 
$pardot->email()->sendToID(1, [...]); // Sends a 1 to 1 email to an ID using an array of email config / data
$pardot->email()->sendToEmail('[email protected]', [...]); // Sends a 1 to 1 email to a email address an array of email config / data
$pardot->email()->send([...]); // send an email to a list of IDs

$pardot->emailTemplate()->listOneToOne(); // Returns a list of email templates used in 1 to 1 emails

$pardot->form()->query([...]); // queries and returns a filtered list
$pardot->form()->read(1); // queries an object by ID

$pardot->lifecycleHistory()->query([...]); // queries and returns a filtered list
$pardot->lifecycleHistory()->read(1); // queries an object by ID

$pardot->lifecycleStage()->query([...]); // queries and returns a filtered list

// @todo

// @todo

// @todo

// @todo

// @todo

$pardot->tagObject()->query([...]); // queries and returns a filtered list
$pardot->tagObject()->read(1); // queries an object by ID

$pardot->tag()->query([...]); // queries and returns a filtered list
$pardot->tag()->read(1); // queries an object by ID

$pardot->user()->query([...]); // queries and returns a filtered list
$pardot->user()->read(1); // queries an object by ID
$pardot->user()->readByEmail('[email protected]'); // queries an object by email

// @todo

$pardot->visitor()->query([...]); // queries and returns a filtered list
$pardot->visitor()->read(1); // queries an object by ID
$pardot->visitor()->assign(1,2); // Assigns or reassigns the visitor by ID to a prospect ID.

$pardot->visit()->query([...]); // queries and returns a filtered list
$pardot->visit()->read(1); // queries an object by ID

$pardot->setDebug(true);

$pardot->setOuput('full');