• jdesrosiers
  • 0 Points
  • Member since 2010

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
  • 2



I manage a website that has a restricted area where you need to sign-in to get the access to download some files.

I would like to use the Leads (SalesForce Object) to store the users that can access this area. So basically, in PHP i would query the salesforce database each time a user would log in, to check his password and email. If this query finds a user, then it would create a session for this private area.

The reason i would use the SalesForce Database instead of a mysql on localhost is to avoid duplication of data (on our website and on SalesForce, because these leads are also our users). So the website's authentication would rely on the SalesForce service to work.


But i tryied a small test (Query sample) and when i benchmark (with ab command) i get like 0.94 req/seconds, which is a bit slow for us (at least 5 time slower that our current login page).


Right now our login page is accessed about 700 times per day. So i'm wondering if it's a good practice to rely on SalesForce for this kind of feature on a website using the PHP toolkit? Is there a limit of queries that one site can do to the SalesForce API on a daily basis? Is this kind of usage of the SalesForce API is even allowed?


Thanks in advance. 


Edit: Added some clarifications 

Message Edited by jdesrosiers on 01-13-2010 01:48 PM
Maybe someone can help me with this problem, I'm new to salesforce and this is driving me up the wall…

We have a site that we're moving over to salesforce to manage our customers when they buy from us.  We have an enterprise account, with Person Accounts enabled, and I have a script (from the salesforce API) that adds a new user to salesforce as a result of a new user signing up on our site.  That works very well.

I need to extend this to include:

1. I need to check to make sure the user isn't already there before adding them.
2. Add product purchase into the opportunity fields to be tracked.  For example, one contact may purchase multiple products, and we want to track them individually.
3. Potentially add referral information (partner id?) into the opportunity
4. Return the response from salesforce and put into local db for tracking.

On a basic level, the API script responds with the id of the user that was added, but have had a hard time doing anything with that (tried using array functions, etc.) other than printing to the screen with print_r.  I also don't know how to find out what products I need to reference for the transactions.

Any help that anyone can provide would be most appreciated. 

Here is the script I have now:

// 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", "phptoolkit-13_1/soapclient");
require_once (SOAP_CLIENT_BASEDIR.'/SforceEnterpriseClient.php');
require_once ('phptoolkit-13_1/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->PersonEmail = 'test@test.com';
  $sObject->BillingStreet = '12 E Walsh Dr';
  $sObject->BillingCity = 'Aurora';
  $sObject->BillingState = 'CO';
  $sObject->BillingPostalCode = '80234';
  $sObject->BillingCountry = 'US';
  $sObject->PersonMailingStreet = '12 E Walsh Dr';
  $sObject->PersonMailingCity = 'Aurora';
  $sObject->PersonMailingState = 'CO';
  $sObject->PersonMailingPostalCode = '80234';
  $sObject->PersonMailingCountry = 'US';

  $createResponse = $mySforceConnection->create(array($sObject), 'Account');

} catch (Exception $e) {
  echo $mySforceConnection->getLastRequest();
  echo $e->faultstring;
  • January 14, 2010
  • Like
  • 0