PHP code example of chronon / ymlp

1. Go to this page and download the library: Download chronon/ymlp 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/ */

    

chronon / ymlp example snippets


CakePlugin::load('Ymlp');

CakePlugin::loadAll();

Configure::write('Ymlp.settings', array(
	'Key' => '1234567890ABCDEFG',
	'Username' => 'yourusername',
));

Configure::write('Ymlp.fieldMap', array(
	'email' => 'Email',
));

public $components = array('Ymlp.Ymlp');

['Subscriber'] => array(
	'email' => '[email protected]'
)

$result = $this->Ymlp->command('Contacts.Add', $this->request->data['Subscriber']);

utility($method, $data = array())

/**
 * A utility method to send anything to the YMLP API
 *
 * @param string $method The YMLP API method call
 * @param array  $data Data to pass to the YMLP method
 * @return string
 * @access public
 */
 
command($method, $data)

/**
 * The primary method to format data, post it to the YMLP API, and then format
 * the returned result.
 *
 * @param string $method The YMLP API method call
 * @param array  $data Data to pass to the YMLP method
 * @return string
 * @access public
 */

public function utility() {
	$result = $this->Ymlp->utility('Fields.GetList');
	debug($result);
	exit;
}

Configure::write('Ymlp.fieldMap', array(
	'email' => 'Email',
	'first_name' => 1,
	'last_name' => 2,
	'address' => 3,
	'city' => 4,
	'state' => 5,
	'zip' => 6,
));