// Create a new header object specifying the namespace, header object type, and hash containing the header details. $header = new SoapHeader("http://www.americommerce.com", "AmeriCommerceHeaderInfo", $header_opts, false); // Set the header on the client instance so that we can authenticate. $client->__setSoapHeaders($header); // Grab the OrderID from the last order placed $lastorder = $client->Order_GetLastOrderID(); // Fetch the order details $order = $client->Order_GetByKey(array("piorderID" => $lastorder->Order_GetLastOrderIDResult))->Order_GetByKeyResult; // Fetch the customer details from the order $customer = $client->Customer_GetByKey(array("picustomerID" => $order->customerID->Value))->Customer_GetByKeyResult; // Lets update some of the customer information $customer->lastName = "John"; $customer->firstName = "Doe"; $Customer->email = "*****@*****.**"; // After updating the customer information, we need to save it on the server $savedCustomer = $client->Customer_SaveAndGet(array("poCustomerTrans" => $customer))->Customer_SaveAndGetResult; } catch (Exception $e) { print_r($e); } ?> <html> <head> <title>Example Customer_SaveAndGet Method</title> </head> <body> <h3>First Name</h3> <?php echo $savedCustomer->firstName; ?> <br/>