function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

How do I display SalesForce data on my website?

I would like to be able to create a php script to copy records meeting my criteria to a mysql database. The database will then be accessed through our website to get a list of our members.

I have been able to test connecting to SalesForce with php and pulling a list of contacts, but this uses one of the user names, passwords and tokens. I would like it to so that we never have to change the login information in the php script, unless major changes are made. What is the best way to connect to SalesForce and not have to worry about password and token expiration?
Park Walker (TAGL)Park Walker (TAGL)

There is no way to connect without using a username and password. What you can do to avoid the password expiration is to create a new profile and set the 'Password Never Expires' and 'API Only' attributes on the profile. Assign the user that you are using to connect to Salesforce that profile and you should be all set.



We are a non-profit and currently at our limit of complimentary users. If I add an api only user will that go towards our total number of users, making us have to pay for one license?
Park Walker (TAGL)Park Walker (TAGL)

Yes, every user counts. The user does not need to be API only (but does need to be an API user), but you might want to consult your license agreement before sharing a user between a live person and the API access.


The key factor here is that you do not want to use a System Administrator profile user account for API access because you cannot turn off the password expiration in that profile. The profile that you do use must have access to all data that you wish to publish on your web site.


Have you looked at the possibility of using Sites to publish you membership list rather than copying the data to a standalone database? 




Do you have an Enterprise or Unlimited Edition?


If so, you could write web services in Apex and then use the Site user to access the web services. 


Hey Dumo,


I guess the php script is just for copying data from SF to your local database so that you can display it on your website. If it's the case then you can look at Salesforce Site to pull data from and post it on your website.


You might also need a VisualForce page with a very simple Apex controller that query the list of members you want. To create a Salesforce site go to Setup -> Develop -> Sites. Once you have enter all the required information, it will give you the URL for the page,you can put it on your site using an Iframe or whatever suits you. Also, don't forget to reference the VisualForce page with the salesforce site you just created.


Good luck,




Sonny -


Your solution seemed closest to what we're needing and I'd like to hear more about your solution. I lose you at Setup -> Develop -> Sites. I do not have a "Sites" option but I do have a "Pages" option. The Pages I can create don't seem to be the solution I need. Is there more you can tell me in this regard?





Hi Amelia,


What edition of salesforce are you using? Drop me an email at son.thai.le at, I can send you some sample codes if you like.