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 = 'Smith';
  $sObject->LastName = 'John';
  $sObject->Phone = '510-555-5555';
  $sObject->BirthDate = '1927-01-25';

  echo "**** Creating the following:\n";
  $createResponse = $mySforceConnection->create(array($sObject), 'Contact');
  print_r($createResponse);

  $id = $createResponse->id;
  $deleteResponse = $mySforceConnection->delete(array ($id));
  echo "***** Deleting record *****\n";
  print_r($deleteResponse);

  echo "***** Wait 60 seconds *****\n";
  sleep('60');
  
  $currentTime = mktime();
  // assume that delete occured within the last 5 mins.
  $startTime = $currentTime-(60*10);
  $endTime = $currentTime;

  echo "***** Get Deleted Leads *****\n";
  $getDeletedResponse = $mySforceConnection->getDeleted('Contact', $startTime, $endTime);
  print_r($getDeletedResponse);
} catch (Exception $e) {
  echo $mySforceConnection->getLastRequest();
  print_r($e);
}
?>

Sample Output

**** Creating the following:
stdClass Object
(
    [id] => 0037000000bcVrwAAE
    [success] => 1
)
***** Deleting record *****
stdClass Object
(
    [id] => 0037000000bcVrwAAE
    [success] => 1
)
***** Wait 60 seconds *****
***** Get Deleted Leads *****
stdClass Object
(
    [deletedRecords] => stdClass Object
        (
            [deletedDate] => 2008-09-17T00:20:46.000Z
            [id] => 0037000000bcVrwAAE
        )

    [earliestDateAvailable] => 2008-01-08T19:56:00.000Z
    [latestDateCovered] => 2008-09-17T00:19:00.000Z
)