+ Start a Discussion
srikanth reddy 27srikanth reddy 27 

Salesforce Integration With PHP

I am new in salesforce integration pls. 
Navee RahulNavee Rahul
Hi srikanth,

what you like to do with salesforce and php??

D Naveen Rahul.
sharathchandra thukkanisharathchandra thukkani
Refer this link : https://developer.salesforce.com/page/PHP_Toolkit
srikanth reddy 27srikanth reddy 27
Hello Rahul,

i want  to create account or contact through php 

is it possible to crate ? if possible how can i?

Navee RahulNavee Rahul
below is an example for creating a Contact but i have changed them to  Account.

download the soap clients and required files from salesforce 

// SOAP_CLIENT_BASEDIR - folder that contains the PHP Toolkit and your WSDL
// $USERNAME - variable that contains your Salesforce.com username (must be in the form of an email)
// $PASSWORD - variable that contains your Salesforce.com password

define("SOAP_CLIENT_BASEDIR", "../../soapclient");
require_once (SOAP_CLIENT_BASEDIR.'/SforceEnterpriseClient.php');
require_once ('../userAuth.php');
try {
  $mySforceConnection = new SforceEnterpriseClient();
  $mySoapClient = $mySforceConnection->createConnection(SOAP_CLIENT_BASEDIR.'/enterprise.wsdl.xml');
  $mylogin = $mySforceConnection->login($USERNAME, $PASSWORD);

  $sObject = new stdClass();
  $sObject->FirstName = 'George';
  $sObject->LastName = 'Smith';
  $sObject->Phone = '510-555-5555';
  $sObject->BirthDate = '1927-01-25';
  $sObject->Email = 'test@test.com';
  $createResponse = $this->_mySforceConnection->create(array($sObject), 'Account');
  echo "Creating New Account\r\n";
  $sObject->FirstName = 'Bill';
  $sObject->LastName = 'Clinton';
  $upsertResponse = $this->_mySforceConnection->upsert('Email', array ($sObject), 'Account');
  echo "Upserting Account (existing)\r\n";
  $sObject->FirstName = 'John';
  $sObject->LastName = 'Smith';
  $sObject->Email = 'testNew@test.com';
  echo "Upserting Account (new)\n";
  $upsertResponse = $this->_mySforceConnection->upsert('Email', array ($sObject), 'Account');
} catch (Exception $e) {
  echo $mySforceConnection->getLastRequest();
  echo $e->faultstring;