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
thetoweringinfernothetoweringinferno 

Php developer, newbie to SF, needs help getting started

I am a php programmer with a decade of experience building websites in php. I built a php website, running on a Linux server, for a client who has recently created a SF account, and wants me to integrate my website with SF. So for example, when someone signs up on the website I built, they would be added as a contact in her SF account. But I'm having huge difficulties understanding the SF developers documentation. I am seeking some "Hello World" examples so that I can get some small scripts working, and from there, hopefully I could be on my way. I'd be eternally grateful for assistance on this.

CheyneCheyne

It sounds to me like the easiest way to do what you need to do would be to install the Force.com Toolkit for PHP, which is a wrapper for the Salesforce SOAP API, and will allow you to easily insert contacts into Salesforce from your website. The Getting Started Guide should tell you everything you need to know, but here is a basic script (from the aforementioned guide) to insert a contact:

 

define("USERNAME", "********");
define("PASSWORD", "********");
define("SECURITY_TOKEN", "************");

require_once ('soapclient/SforceEnterpriseClient.php');

$mySforceConnection = new SforceEnterpriseClient();
$mySforceConnection->createConnection("enterprise.wsdl.xml");
$mySforceConnection->login(USERNAME, PASSWORD.SECURITY_TOKEN);

$records = array();

$records[0] = new stdclass();
$records[0]->FirstName = 'John';
$records[0]->LastName = 'Doe';

$response = $mySforceConnection->create($records, 'Contact');


 Hope this helps!

jaba rajjaba raj

hi just see below coding which will give u some idea...

 

<?php

echo "<html><head><title>Salesforce User information</title>";
//connection string to salesforce
define("USERNAME", "xxxx");
define("PASSWORD", "yyyy");
define("SECURITY_TOKEN", "JyaFHLIU1mJ4GW1OKmQJoRZt");
require_once ('soapclient/SforceEnterpriseClient.php');
$mySforceConnection = new SforceEnterpriseClient();
$mySforceConnection->createConnection("soapclient/enterprise.wsdl.xml");
$mySforceConnection->login(USERNAME, PASSWORD.SECURITY_TOKEN);
 
 
 
echo "</head><body>";
$query = "SELECT Id, Name from user";
    $response = $mySforceConnection->query($query);
    echo "Results of query '$query'<br/><br/>\n";
    foreach ($response->records as $record) 
    {
           // Id is on the $record, but other fields are accessed via the fields object
  
       echo "<table border='2'>
  <tr>
<th>id</th>
<th>username</th>
  </tr>
  <tr>
        <td>$record->Id<\td>
      <td>$record->Name<\td>
</tr>
</table>" ;
 
    }
echo "</body></html>";
 
?>
 
 
life is a race enjoy it....