PHP code example of findforsikring / leadvalidator-clients

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

    

findforsikring / leadvalidator-clients example snippets


$client = new \LeadValidator\SourceClient("api token");

// List available campaigns
$campaigns = $client->getCampaigns();

// Detailed campaign info
$campaign = $client->getCampaign(12);

/* 
 * Post a lead
 * 1st parameter is campaign ID.
 * 2nd parameter must use keys defined in the campaign
 */
$success = $client->postLead(12, [
    'name' => 'Lead name',
    'phone' => '12345678',
    'email' => '[email protected]'
]);

$client = new \LeadValidator\CustomerClient("api token");

/* 
 * Get all new leads (not delivered yet)
 * Optionally limit by campaign or source
 * Optional pagination
 */
$leads = $client->getNewLeads();

/* 
 * Get all leads from a period
 * Limit by creation-time or delivery-time
 * Optionally limit by campaign or source
 * Optional pagination
 */
$leads = $client->getLeadsFromPeriod();