Sample Call

<?php
// 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", "../../soapclient");
require_once (SOAP_CLIENT_BASEDIR.'/SforceEnterpriseClient.php');
require_once ('../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->BirthDate = '1927-01-25';
  $sObject->Email = 'test@test.com';
		
  $createResponse = $this->_mySforceConnection->create(array($sObject), 'Contact');
  echo "Creating New Contact\r\n";
  print_r($createResponse);
		
  $sObject->FirstName = 'Bill';
  $sObject->LastName = 'Clinton';
		
  $upsertResponse = $this->_mySforceConnection->upsert('Email', array ($sObject), 'Contact');
  echo "Upserting Contact (existing)\r\n";
  print_r($upsertResponse);
		
  $sObject->FirstName = 'John';
  $sObject->LastName = 'Smith';
  $sObject->Email = 'testNew@test.com';
		
  echo "Upserting Contact (new)\n";
  $upsertResponse = $this->_mySforceConnection->upsert('Email', array ($sObject), 'Contact');
  print_r($upsertResponse);
} catch (Exception $e) {
  echo $mySforceConnection->getLastRequest();
  echo $e->faultstring;
}
?>

Sample Output

Creating New Contact
stdClass Object
(
    [id] => 0035000000o1afRAAQ
    [success] => 1
)
Upserting Contact (existing)
stdClass Object
(
    [created] => 
    [id] => 0035000000o1afRAAQ
    [success] => 1
)
Upserting Contact (new)
stdClass Object
(
    [created] => 1
    [id] => 0035000000o1aeUAAQ
    [success] => 1
)