Blog
Salesforce Cloud Integration with PHP

Salesforce Integration with Php begins with the Force.com Web Services API. The API is Salesforce SOAP API or Salesforce REST API based and we will be using the PHP Toolkit provided by Salesforce; you still need to have the PHP Soap extension installed, but the toolkit provides convenient utility methods for all of the available API calls. We need to use the API when you want to integrate salesforce with your application can be in any language like PHP, Java, and .net.


PHP has proved itself as one of the major web development contributors in the world. Lots of websites have been built using the PHP programming language. On the other hand, Salesforce Cloud is a new aged Customer Relation Management (CRM) platform for supercharging every part of the company that interacts with customers- including Sales, Marketing, Customer Service and many more.

Salesforce Force.com platform supports several API’s including SOAP and REST API to integrate Salesforce with other languages like Java, Dot.Net, PHP and many more.

 

                                                                         Salesforce Integration                            

Business Requirement
BISP is an Online Training + Consulting company. BISP Solutions Inc. USA was formed in 2012 with the aim of providing affordable Oracle Cloud and BI Solution to companies who are looking for specialized Cloud knowledge without spending top dollars. BISP provides one-stop solution to Business Analytics, Oracle Cloud solution stack. BISP was formed by individuals who are certified Professionals and have 15+ years of experience in Oracle BI Solution over a wide range of domains. BISP provides expert technical and functional sources who thoroughly understand Oracle Cloud technologies. With proper design framework and BI expertise, it enhances financial and operational performance.

In order to get new leads, BISP solutions prepared a website: www.bisptrainings.com and Integrate it with backend database to capture customer data using contact us form. To serve client/customers in a more fast and efficient way BISP started using Salesforce CRM. Till now Marketing executives need to enter data manually into Salesforce Objects (Mainly Lead Object). BISP wants to make this process automated especially capturing data into Salesforce and sending acknowledgment email.

Possible Solutions:
There are multiple solutions to complete their task (3 Major Solutions mentioned)

Solution 1: User Third-Party tools to perform Integration between BISP website database and Salesforce App and schedule it.

Solution 2: Use Python to integrate both BISP website database and Salesforce APP using REST API.
Key Note: For this, a person must have knowledge of Python as well.
 
Solution 3: Using PHP toolkit provided by Salesforce to Support PHP Integration (Fast and Easy)

Based on their requirement and effective solutions we will go with Solution 3

Key Note: In this document, we explain step by step Integration between PHP and Salesforce (To Capture New Leads) using PHP Toolkit.

Steps to integrate:

  • Download PHP toolkit
  • You can download PHP toolkit from below URL-

GITS- https://github.com/developerforce/Force.com-Toolkit-for-PHP

                                     

 

  • Click on Clone or download button 
  • Download Zip File
  • Save it on the local drive

BISP Trainings Contact-US Page

BISP contact us form

This page was designed in PHP and as per requirement once the user fills a form and submit button need to generate a new lead in Salesforce Lead Object.

Steps to use PHP toolkit for Integration

Step 1:

Unzip PHP toolkit download in the previous step and look for SOAP client Folder

 

Toolkit for php

Step 2: 
Copy Soapclient Folder from PHP toolkit extracted directory and paste it into Project Directory (My project directory is C:Xampphtdocsisp)

SOAP client

Download “Partner WSDL” file from Salesforce
In order to integrate PHP with Salesforce using toolkit WSDL file will be required. (Partner WSDL or Enterprise WSDL).

Steps to Download WSDL from Salesforce

Step 1: Login into Salesforce Org. www.salesforce.com

Step 2:  Click on Setup

                                     →in the Search box on right side Enter “API” 

                                                                                                      → Under Build select API

 

Salesforce API

Step 3: Click on Generate Partner WSDL

API WSDL

Step 4: On the next Tab, XML file will open.

Right-click anywhere within a document and click on Save as→ give name as “Partner WSDL.xml”

Partner WSDL

 

Step 5: Copy and save WSDL XML file into the project directly within ht docs.

Code to save data into Salesforce Lead Object from BISP Contact-US PHP page. 

Below code will help you to store data into Salesforce.

Integration code

If (isset ($_POST ['Submit']))

{    //Capture data from Contact-US page fields and store into fields.

$fname=$_POST['first_name'];

$lname=$_POST['last_name'];

$email=$_POST['email'];

$phone=$_POST['phone'];

$message=$_POST['00N2v00000IcS9G'];

define("USERNAME", "sumit07092019@bisp.com"); 

define("PASSWORD", "Admin12345"); 

define("SECURITY_TOKEN", "WYUajxtjAiCo0idqhfrrhaU7");

require_once ('C:xampphtdocsispsoapclientSforcePartnerClient.php');

//define connection with salesforce

$mySforceConnection = new SforcePartnerClient();

$mySforceConnection->createConnection("PartnerWSDL.xml");

$mySforceConnection->login(USERNAME, PASSWORD.SECURITY_TOKEN);

//Record array to store data into Object

$records = array();

$records[0] = new SObject();

$records[0]->fields = array( 

'FirstName' => $fname,

'LastName' => $lname,

'Phone' => $phone, 

'Email' => $email,
 
'Message c'=>$message, 'Company' => 'Individual'

);

$records[0]->type = 'Lead';

$response = $mySforceConnection->create($records); //Insert Records and Capture response 

echo "Your Details Inserted Succesfully";

}

?>

Testing:

Steps to test Integration 

Step1: Start Xampp Server

xampp server

Step 2: Run the application and fill details

contact us BISP inquiry

 

Step 3: Click on Contact Button.

Result stored into Salesforce lead object.

salesforce inquiry

Thanks for reading....

We have Highly-focused study material in our online academia and it's really helpful for our candidates and professionals, our professional online salesforce training courses are a mixture of study materials, real-world scenario, use cases, and hands-on experience and we will be providing an industry project to our candidates or professionals, so that candidates can easily prepare himself for any specific role. We have recommended our experienced experts and real-time professionals for training and guidance out there, as well as they,  are sharing his industry experience with candidates. 

For more guidance please reach out to us, we can share a real-time experience.                       

Share: -9  -20  -14 
View:21  

Thoughts on “Salesforce Cloud Integration with PHP””

Leave a Reply

Your email address will not be published. Required fields are marked *