PHP code example of generationtux / marketo-rest-api-client

1. Go to this page and download the library: Download generationtux/marketo-rest-api-client 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/ */

    

generationtux / marketo-rest-api-client example snippets


$client = new Client([
    'api_url' => 'foo.bar/api',
    'client_id' => 'foobarid',
    'client_secret' => 'foobarsecret'
]);

$client->leads()->create([
    [
      'firstName' => 'Joe',
      'lastName'  => 'Bar',
      'email'     => '[email protected]'
    ],
    [
      'firstName' => 'Sally',
      'lastName'  => 'Bar',
      'email'     => '[email protected]'
    ]
]);

$lead = $client->leads()->show('[email protected]'); // outputs an object with all valid information on the lead

$lead->email; // outputs '[email protected]'

$client-campaign()
    ->trigger(1234, '[email protected]',
        [
            '{{my.name}}' => 'Foo'
        ]
    );