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.ocm password

define("SOAP_CLIENT_BASEDIR", "../../soapclient");
require_once (SOAP_CLIENT_BASEDIR.'/SforcePartnerClient.php');
require_once (SOAP_CLIENT_BASEDIR.'/SforceHeaderOptions.php');

try {
	$mySforceConnection = new SforcePartnerClient();
	$mySoapClient = $mySforceConnection->createConnection(SOAP_CLIENT_BASEDIR.'/partner.wsdl.xml');
	$mylogin = $mySforceConnection->login($USERNAME, $PASSWORD);

	$obj1 = new SObject();
	$obj1->type = 'Lead';

	$fields = array (
  'Company' => 'XYZ Company',
  'FirstName' => 'John',
  'LastName' => 'Smith',
  'LeadSource' => 'Other',
  'NumberOfEmployees' => 1,
  'Status' => 'Open'
  );
  $obj1->fields = $fields;
  $createResponse = $mySforceConnection->create(array ($obj1));
  echo "***** Creating Lead *****\n";
  print_r($createResponse);

  $id = $createResponse->id;
  $deleteResponse = $mySforceConnection->delete(array ($id));
  echo "***** Deleting Lead *****\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('Lead', $startTime, $endTime);
  print_r($getDeletedResponse);

} catch (Exception $e) {
	print_r($e);
}
?>

Sample Output

***** Creating Lead *****
stdClass Object
(
    [id] => 00Q5000000K07xdEAB
    [success] => 1
)
***** Deleting Lead *****
stdClass Object
(
    [id] => 00Q5000000K07xdEAB
    [success] => 1
)
***** Wait 60 seconds *****
***** Get Deleted Leads *****
stdClass Object
(
    [deletedRecords] => Array
        (
            [0] => stdClass Object
                (
                    [deletedDate] => 2008-01-24T22:45:55.000Z
                    [id] => 00Q5000000K07qsEAB
                )

            [1] => stdClass Object
                (
                    [deletedDate] => 2008-01-24T22:47:56.000Z
                    [id] => 00Q5000000K07vsEAB
                )

            [2] => stdClass Object
                (
                    [deletedDate] => 2008-01-24T22:48:51.000Z
                    [id] => 00Q5000000K07xdEAB
                )

        )

    [earliestDateAvailable] => 2007-11-07T19:53:00.000Z
    [latestDateCovered] => 2008-01-24T22:49:00.000Z
)