Sample Call

<?php
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@domain.com", "changeme");

  $fields = array (
    'FirstName' => 'John',
    'LastName' => 'Smith',
    'Phone' => '510-555-5555',
    'BirthDate' => '1950-01-01'
  );

  $sObject = new SObject();
  $sObject->fields = $fields;
  $sObject->type = 'Contact';

  $sObject2 = new SObject();
  $sObject2->fields = $fields;
  $sObject2->type = 'Contact';

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

  print_r($createResponse);
  
  $ids = array();
  foreach ($createResponse as $createResult) {
    print_r($createResult);
    array_push($ids, $createResult->id);
  }
  echo "**** Now for Delete:\r\n";
  $deleteResult = $mySforceConnection->delete($ids);
  print_r($deleteResult);

  echo "**** Now for UnDelete:\r\n";
  $deleteResult = $mySforceConnection->undelete($ids);
  print_r($deleteResult);  

} catch (Exception $e) {
  echo $mySforceConnection->getLastRequest();
  echo $e->faultstring;
}
?>

Sample Output

**** Creating the following:
Array
(
    [0] => stdClass Object
        (
            [id] => 0035000000UagWtAAJ
            [success] => 1
        )

    [1] => stdClass Object
        (
            [id] => 0035000000UagWuAAJ
            [success] => 1
        )

)
stdClass Object
(
    [id] => 0035000000UagWtAAJ
    [success] => 1
)
stdClass Object
(
    [id] => 0035000000UagWuAAJ
    [success] => 1
)
**** Now for Delete:
Array
(
    [0] => stdClass Object
        (
            [id] => 0035000000UagWtAAJ
            [success] => 1
        )

    [1] => stdClass Object
        (
            [id] => 0035000000UagWuAAJ
            [success] => 1
        )

)
**** Now for UnDelete:
Array
(
    [0] => stdClass Object
        (
            [id] => 0035000000UagWtAAJ
            [success] => 1
        )

    [1] => stdClass Object
        (
            [id] => 0035000000UagWuAAJ
            [success] => 1
        )

)