We need to create a PHP form that will simultaneously send data to two Salesforce orgs, and update Accounts, Contacts, and some custom objects. Is it possible? What will be the best approach to implement this? ( How can I send requests to two different orgs from one PHP form?)

Edit 1 I am trying to do it with REST API. I am a newbie, so examples would be greatly appreciated Thanks a lot.

Edit 2 How can I send form data to Salesforce orgs without asking user to authenticate to these orgs? Other words, how can I authenticate and authorize external APH app to access Force REST API? Is it only possible with OAuth1, or can I use OAuth2 too? (I am looking on this example: http://blog.jeffdouglas.com/2010/07/23/using-oauth-to-authorize-external-applications-2/) Thanks.

  • 3
    You can use 1 form and on submit you'll call your local PHP code that will map the data accordingly and then send to both instances. Aug 14, 2013 at 23:46
  • I am using this example for REST API: developer.force.com/cookbook/recipe/…. How can I open two sessions for two orgs ?
    – vlr
    Aug 15, 2013 at 0:39
  • In addition to e-bacho's comment, this is another reason to use the Post/Redirect/Get pattern.
    – Nick C
    Aug 15, 2013 at 0:40
  • 2
    You need to extend the config and the oauth methods and define URLs and cosnumer tokens/secrets for the second instance. Once you finish sending the data to the first one (as per the example), you close the session and open a new one for the second instance. If I get a chance during the day I'll try to put an example code together... Aug 15, 2013 at 1:15

1 Answer 1


It is certainly possible.

If you use the Salesforce PHP Toolkit for a little bit it will be very obvious how to make two distinct Soap clients within one PHP script.

If you are worried about the delay of having to make the calls one after another you could have the user's browsers make invocations to the PHP synchronously via JavaScript.

One last point worth mentioning is that if the scenario calls for it you will need to consider how you will handle atomicity, i.e. What do you do if one Salesforce instance fails to complete it's transaction?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .