This is a discussion on Connecting PHP form to Salesforce within the Salesforce PHP Tutorials forums, part of the Salesforce category; Hi All,
I apologize if this topic is already covered in the
I apologize if this topic is already covered in the earlier posts. I am a beginner in both PHP and Salesforce. My current assignment is I need to connect PHP form which accepts donations through credit cards to Salesforce opportunity.Once the payment is made I need to transfer the donation information to Salesforce. I am using nonprofit starter pack for Salesforce. Could any one please give me direction to start this? Your help is greatly appreciated.
1.) What data points are you collecting in your webform?
2.) By beginner, how much experience do you have in both PHP and Salesforce?
3.) Do you know if the non-profit edition of Salesforce.com gives you access to the Webservices API?
Also, if you have any code that you've tried or could be more specific the actual process it would be great. If your goal is to simply pass details from the web form to an opportunity, it should actually be really straight forward.
Re: 3) Isn't nonprofit Salesforce is based on one of the commercial editions of Salesforce?
(We have NonProfit Salesforce and can access it through the API because it is based on Enterprise Edition.
Riya, which commercial edition it is based on?).
Thank you for your reply. Following are my answers to your questions.
1. What data points are you collecting in your webform?
I am collecting following details:
Donation For --> drop down list
other:
Donation Amount US Dollar
Contact information
First Name, Last Name, Address Line 1, Address Line 2, City, State, ZIP/Postal Code, country, phone, email
Payment Information:
Cardholder's Name, credit Card Number, Credit Card Type and Expiration Date
Optional:
Donate in honor of someone:
2. Experience
I installed PHP 5.5 on IIS web server. I am practicing beginner tutorial.
I just completed course on Salesforce development.I know different components in Salesforce and basic knowledge on APEX and Visualforce.
3. I am assuming that it provides access to Webservices API since Nonprofit starter pack is based on Enterprise edition.
I have requested non profit organization to send me PHP code they have used to develop donation form and I will get it soon.
Since I do not have code now, I would like to try how simple PHP contact form is connected to Salesforce. I will pass contact details from php form to Salesforce lead entity. This exercise is to know how the basic connection is done from PHP to Salesforce. Could you please send me any sample PHP form with Salesforce connection details? Please guide me on this.
This is Mike's territory for the PHP connection to your salesforce.com org but I can give you some gotchas:
1.) Keep the login credentials and the actual script in two different places and simply call the login credentials. The biggest reason for this is because the security tokens could bite you at the end of the day and having it all in one spot is convenient.
2.) If you have a dev environment and you for some reason use URLs, make sure you switch those up.
3.) Be careful of validation rules... they'll bite you if you're not careful
Once Mike posts the connections, we can figure out how to map the data from your form into Salesforce
First do me a favor and never apologize for asking a question, no matter how small it is....
This site is about helping people and that is it. Listen like Will said, thanks for joining the site
Let's see if we can get you started, I am going to ask you a few questions though:
1) Since you installed PHP on a Windows machine, have you been able to get it to connect to Salesforce at all? I am guessing not
A) First you will need to download the PHP Tool Kit from Salesforce.com, which I am attaching to this post.
B) Then you will need to ensure that your connection to Salesforce is working. Here is some code for a central login script which you can use in all your PHP scripts by just including it. This saves you time when you have to change your password for Salesforce and not having to change it in a ton of scripts:
C) Make sure that you change all the necessary information in the script, such as the paths to match your server and the login information.
D) When you download the toolkit there is a WSDL file in the download called the partner.wsdl.xml file. I would login to your salesforce organization and navigate to Setup > App Setup > API and you will see different WSDL files. Get a new copy of the partner WSDL file and replace the one that is in the toolkit. This will give you the most updated WSDL file.
2) Now call that login php script from the browser and see if you get any errors.
3) If you do not then we can get on with the form and how to get the data into Salesforce. If you do get errors, we will need to fix those prior to getting started
Thank you for helping me to start my assignment in the right direction. As you mentioned, I downloaded PHP tool kit. I replaced the partner.wsdl.xml file with newly generated partner.wsdl.xml file from Salesfore.Finally I made modifications to PHP file according to my user id, password and path.
When I called login php from a firefox browser, I get blank page. No error message. When I gave some print statement it is showing that on output.If the print statement is after the following statement i$client->createConnection($wsdl); print statement is not displaying.
How can I debug this? Does it have problem with newly generated WSDL? Please help me on this.
Bookmarks