below is an example for creating a Contact but i have changed them to Account.
download the soap clients and required files from salesforce https://developer.salesforce.com/page/PHP_Toolkit
<?php // 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
what you like to do with salesforce and php??
Thanks
D Naveen Rahul.
i want to create account or contact through php
is it possible to crate ? if possible how can i?
thanks.
download the soap clients and required files from salesforce
https://developer.salesforce.com/page/PHP_Toolkit
<?php
// 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";
print_r($createResponse);
$sObject->FirstName = 'Bill';
$sObject->LastName = 'Clinton';
$upsertResponse = $this->_mySforceConnection->upsert('Email', array ($sObject), 'Account');
echo "Upserting Account (existing)\r\n";
print_r($upsertResponse);
$sObject->FirstName = 'John';
$sObject->LastName = 'Smith';
$sObject->Email = 'testNew@test.com';
echo "Upserting Account (new)\n";
$upsertResponse = $this->_mySforceConnection->upsert('Email', array ($sObject), 'Account');
print_r($upsertResponse);
} catch (Exception $e) {
echo $mySforceConnection->getLastRequest();
echo $e->faultstring;
}
?>