PHP code example of cloudassessments / salesforce-web-to-lead

1. Go to this page and download the library: Download cloudassessments/salesforce-web-to-lead 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/ */

    

cloudassessments / salesforce-web-to-lead example snippets




use CloudAssessments\Salesforce\WebToLead;

$form = new WebToLead();
$form
    ->setSalesforceAccountIdentifier('YourAccountID')  
    ->submit(                                          
        [                                              
            'first_name'      => 'John',               
            'last_name'       => 'Doe',                
            'email'           => '[email protected]',
            'phone'           => '555-123-4567',       
            'company'         => 'Acme Inc.',          
            'lead_source'     => 'Web-to-Lead',        
        ]                                              
    );

use CloudAssessments\Salesforce\WebToLead;

$form = new WebToLead();
$form
    ->setSalesforceAccountIdentifier('YourAccountID')  
    ->submit(                                          
        [                                              
            'first_name'      => 'John',
            'last_name'       => 'Doe',
            'email'           => '[email protected]',
            'lead_source'     => 'Web-to-Lead',
             // Your new Referral Source field below
            '00N46000009SDY5 => 'https://example.com/referral-page',
        ]                                              
    );