BeginTransaction(); if ($status) { $query = "SELECT holding.holdingid, holding.quantity, holding.purchaseprice, holding.purchasedate, holding.quote_symbol,holding.account_accountid FROM holding WHERE holdingid= '$sellInfo->holdingID'"; $result = $db->ExecuteQuery($query); $dbval = $db->GetSQLValue($result); $symbol = $dbval['quote_symbol']; if ($symbol) { $order = createOrder($sellInfo->userID, $symbol, ORDER_TYPE_SELL, $sellInfo->quantity, $sellInfo->holdingID, $db); /*$order->openDate = "2008-05-30T19:27:30.78125+05:30"; $order->completionDate = "2008-05-30T19:27:30.890625+05:30";*/ $order->orderStatus = "open"; if ($order) { processSubmitOrder($order); $response = new sellEnhancedResponse(); $response->sellEnhancedReturn = new OrderDataBean(); $response->sellEnhancedReturn = $order; $db->CommitTransaction(); } else { $db->RollbackTransaction(); } } else { $db->RollbackTransaction(); } $db->CloseDatabase(); } } return $response; } /** * This is the utility method to get the Top orders of a user. * @param userID is the userID of a particular user. * @return an array of OrderDataBean objects. */ function processGetTopOrders($userID) { $db = GetDatabase(); $response = null; if($db) { $query = "SELECT orderid, ordertype, orderstatus, opendate, completiondate, quantity, price, orderfee, quote_symbol FROM orders WHERE orders.account_accountid = (SELECT account.accountid FROM account WHERE account.profile_userid = '$userID') ORDER BY orders.orderid DESC"; $result = $db->ExecuteQuery($query); if($result) { $response = new getOrdersResponse(); $response->getOrdersReturn = new ArrayOfOrderDataBean(); $rawNo = 0; while(($dbval = $db->GetSQLValue($result))) { $orderID = $dbval['orderid']; $response->getOrdersReturn->OrderDataBean[$rawNo] = new OrderDataBean(); $response->getOrdersReturn->OrderDataBean[$rawNo]-> orderID = $orderID; $response->getOrdersReturn->OrderDataBean[$rawNo]-> orderType = $dbval['ordertype']; $response->getOrdersReturn->OrderDataBean[$rawNo]-> orderStatus = $dbval['orderstatus']; $response->getOrdersReturn->OrderDataBean[$rawNo]-> openDate = formatDate($dbval['opendate']); $response->getOrdersReturn->OrderDataBean[$rawNo]-> completionDate = formatDate($dbval['completiondate']); $response->getOrdersReturn->OrderDataBean[$rawNo]-> quantity = $dbval['quantity']; $response->getOrdersReturn->OrderDataBean[$rawNo]-> price = $dbval['price']; $response->getOrdersReturn->OrderDataBean[$rawNo]-> orderFee = $dbval['orderfee']; $response->getOrdersReturn->OrderDataBean[$rawNo]-> symbol = $dbval['quote_symbol']; $rawNo = $rawNo + 1; if ($rawNo == TOP_ORDERS) { break; } } } $db->CloseDatabase(); } return $response; } /** * This utility method get the holding information of a particualr holding. * @param holdingInfo holdingID, and the userID * @return a HoldingDataBean object, which the holding information. */ function processGetHolding($holdingInfo) { $db = GetDatabase(); $response = null; if($db) { $query = "SELECT holding.account_accountid, holding.quantity, holding.purchaseprice, holding.purchasedate, holding.quote_symbol FROM holding WHERE holding.holdingid='$holdingInfo->holdingID' AND holding.account_accountid = (SELECT accountid FROM account WHERE profile_userid = '$holdingInfo->userID')"; $result = $db->ExecuteQuery($query); if ($result) { $response = new getHoldingResponse(); $response->getHoldingReturn = new HoldingDataBean(); $dbval = $db->GetSQLValue($result); $response->getHoldingReturn->holdingID = $holdingInfo->holdingID; $response->getHoldingReturn->quantity = $dbval['quantity']; $response->getHoldingReturn->purchasePrice = $dbval['purchaseprice']; $response->getHoldingReturn->purchaseDate = formatDate($dbval['purchasedate']); $response->getHoldingReturn->quoteID = $dbval['quote_symbol']; } $db->CloseDatabase(); } return $response; } /** * This utility method is used to register a new user into the system. * @param userInfo, information required to register a new user to the system. * @return an AccountDataBean object correspond to the registered user. */ function processRegister($userInfo) { $db = GetDatabase(); $response = null; if($db) { $queryAccount = "INSERT INTO account (creationdate, openbalance, logoutcount, balance, lastlogin, logincount, profile_userid) VALUES (CURRENT_TIMESTAMP, '$userInfo->openBalance', '0', '$userInfo->openBalance', CURRENT_TIMESTAMP, '0', '$userInfo->userID')"; $queryAccountProfile = "INSERT INTO accountprofile VALUES ('$userInfo->address', '$userInfo->password', '$userInfo->userID', '$userInfo->email', '$userInfo->creditcard', '$userInfo->fullname')"; $result = $db->ExecuteQuery($queryAccountProfile); if ($result) { $result = null; $result = $db->ExecuteQuery($queryAccount); $accountID = $db->GetInsertID(); if (($accountID) && ($accountID != -1)) { $response = new registerResponse(); $response->registerReturn = new AccountDataBean(); $response->registerReturn->accountID = $accountID; $response->registerReturn->loginCount = 0; $response->registerReturn->logoutCount = 0; $response->registerReturn->balance = $userInfo->openBalance; $response->registerReturn->openBalance = $userInfo->openBalance; $response->registerReturn->profileID = $accountID; } } $db->CloseDatabase(); } return $response; } /** * This utility method is used to get MarketSummary information. * @return a getMarketSummary object with market summary information. */ function processGetMarketSummary() { $db = GetDatabase(); $response = null; if($db) { $queryTSIA = "SELECT SUM(price)/COUNT(*) AS tsia FROM quote WHERE symbol like 's:%'"; $queryOPENTSIA = "SELECT SUM(open1)/COUNT(*) AS openTSIA FROM quote WHERE symbol LIKE 's:%'"; $queryVolume = "SELECT SUM(volume) FROM quote WHERE symbol LIKE 's:%'"; $queryGainers = "SELECT symbol, companyname, volume, price, open1, low, high, change1 FROM quote WHERE symbol LIKE 's:%' ORDER BY change1 DESC"; $queryLosers = "SELECT symbol, companyname, volume, price, open1, low, high, change1 FROM quote WHERE symbol LIKE 's:%' ORDER BY change1"; $response = new getMarketSummaryResponse(); $response->getMarketSummaryReturn = new MarketSummaryDataBeanWS(); $result = $db->ExecuteQuery($queryTSIA); if ($result) { $dbval = $db->GetSQLValue($result); $response->getMarketSummaryReturn->TSIA = $dbval['tsia']; $result = null; } $result = $db->ExecuteQuery($queryOPENTSIA); if ($result) { $dbval = $db->GetSQLValue($result); $response->getMarketSummaryReturn->openTSIA = $dbval['opentsia']; $result = null; } $result = $db->ExecuteQuery($queryVolume); if($result) { $dbval = $db->GetSQLValue($result); $response->getMarketSummaryReturn->volume = $dbval[0]; $result = null; } $result = $db->ExecuteQuery($queryGainers); if($result) { $response->getMarketSummaryReturn->topGainers = new ArrayOfQuoteDataBean(); $rawNo = 0; while(($dbval = $db->GetSQLValue($result)) && $rawNo < 5) { $symbol = $dbval['symbol']; $response->getMarketSummaryReturn->topGainers-> QuoteDataBean[$rawNo] = new QuoteDataBean(); $response->getMarketSummaryReturn->topGainers-> QuoteDataBean[$rawNo]->symbol = $symbol; $response->getMarketSummaryReturn->topGainers-> QuoteDataBean[$rawNo]->companyName = $dbval['companyname']; $response->getMarketSummaryReturn->topGainers-> QuoteDataBean[$rawNo]->volume = $dbval['volume']; $response->getMarketSummaryReturn->topGainers-> QuoteDataBean[$rawNo]->price = $dbval['price']; $response->getMarketSummaryReturn->topGainers-> QuoteDataBean[$rawNo]->open = $dbval['open1']; $response->getMarketSummaryReturn->topGainers-> QuoteDataBean[$rawNo]->low = $dbval['low']; $response->getMarketSummaryReturn->topGainers-> QuoteDataBean[$rawNo]->high = $dbval['high']; $response->getMarketSummaryReturn->topGainers-> QuoteDataBean[$rawNo]->change = $dbval['change1']; $rawNo = $rawNo + 1; } $result = null; } $result = $db->ExecuteQuery($queryLosers); if($result) { $response->getMarketSummaryReturn->topLosers = new ArrayOfQuoteDataBean(); $rawNo = 0; while(($dbval = $db->GetSQLValue($result)) && $rawNo < 5) { $symbol = $dbval['symbol']; $response->getMarketSummaryReturn->topLosers-> QuoteDataBean[$rawNo] = new QuoteDataBean(); $response->getMarketSummaryReturn->topLosers-> QuoteDataBean[$rawNo]->symbol = $symbol; $response->getMarketSummaryReturn->topLosers-> QuoteDataBean[$rawNo]->companyName = $dbval['companyname']; $response->getMarketSummaryReturn->topLosers-> QuoteDataBean[$rawNo]->volume = $dbval['volume']; $response->getMarketSummaryReturn->topLosers-> QuoteDataBean[$rawNo]->price = $dbval['price']; $response->getMarketSummaryReturn->topLosers-> QuoteDataBean[$rawNo]->open = $dbval['open1']; $response->getMarketSummaryReturn->topLosers-> QuoteDataBean[$rawNo]->low = $dbval['low']; $response->getMarketSummaryReturn->topLosers-> QuoteDataBean[$rawNo]->high = $dbval['high']; $response->getMarketSummaryReturn->topLosers-> QuoteDataBean[$rawNo]->change = $dbval['change1']; $rawNo = $rawNo + 1; } $result = null; } /*$result = $db->ExecuteQuery($querySummaryDate); if($result) { $response->getMarketSummaryReturn->summaryDate = $db->GetSQLValue($result, 0, 0); $result = null; }*/ $db->CloseDatabase(); } return $response; } /** * This utility method is used to get accountID corresond to a particular userID. * @param userID userID. * @param db database object * @return the accountID of the user. */ function getAccountID($userID, $db) { $response = null; $query = "SELECT accountid FROM account WHERE profile_userid = '$userID'"; $result = $db->ExecuteQuery($query); if($result) { $dbval = $db->GetSQLValue($result); $response = $dbval['accountid']; } return $response; } /** * This utility method is used to create an order in the system. * @param userID userID * @param symbol symbol * @param orderType type of the order (buy|sell) * @param quantity amount (buy|sell) * @param holdingID holdingID of the order (apply for sell) * @param db database object * @return an OrderDataBean object. */ function createOrder($userID, $symbol, $orderType, $quantity, $holdingID, $db) { $order = null; $order = new OrderDataBean(); $order->price = INITIAL_ORDER_PRICE; $order->orderType = $orderType; $order->orderStatus = "open"; $order->quantity = $quantity; $order->symbol = $symbol; if ($orderType == ORDER_TYPE_BUY) { $order->orderFee = BUY_ORDER_FEE; } elseif ($orderType == ORDER_TYPE_SELL) { $order->orderFee = SELL_ORDER_FEE; } $query = "INSERT INTO orders (opendate, orderfee, price, quote_symbol, quantity, ordertype, orderstatus, account_accountid, holding_holdingid) VALUES (CURRENT_TIMESTAMP, '$order->orderFee', '$order->price', '$order->symbol', '$order->quantity', '$orderType', 'open', '".getAccountID($userID, $db)."', '$holdingID')"; $result = $db->ExecuteQuery($query); $order->orderID = $db->GetInsertID(); return $order; } /** * This is the utility method to process a sell request. * After creating an order, it passes it to order processor for * further processing. * @param buyInfo contains buy operation information. * @return an order object correspond to the order. */ function processBuy($buyInfo) { $db = GetDatabase(); $response = null; if ($db) { $status = $db->BeginTransaction(); $order = createOrder($buyInfo->userID, $buyInfo->symbol, ORDER_TYPE_BUY, $buyInfo->quantity, INITIAL_HOLDING_ID, $db); /*$order->openDate = "2008-05-30T19:27:30.78125+05:30"; $order->completionDate = "2008-05-30T19:27:30.890625+05:30";*/ $order->orderStatus = "open"; if ($order) { processSubmitOrder($order); $response = new buyResponse(); $response->buyReturn = new OrderDataBean(); $response->buyReturn = $order; $db->CommitTransaction(); } else { $db->RollbackTransaction(); } $db->CloseDatabase(); } return $response; } /** * This method is used by the ConfigWeb application to check the connectivity. * @return a QuoteDataBean object with nill */ function connectivityResponse() { $response = new getQuoteResponse(); $response->getQuoteReturn = new QuoteDataBean(); return $response; } /** * This is the utility method to process a getQuote request. * @param symbol symbol. * @return a QuoteDataBean object. */ function processGetQuote($symbol) { if ($symbol) { $db = GetDatabase(); $response = null; if($db) { $query = "SELECT symbol, companyname, volume, price, open1, low, high, change1 FROM quote WHERE symbol = '$symbol'"; $result = $db->ExecuteQuery($query); if ($result) { $response = new getQuoteResponse(); $response->getQuoteReturn = new QuoteDataBean(); $dbval = $db->GetSQLValue($result); $response->getQuoteReturn->symbol = $dbval['symbol']; $response->getQuoteReturn->companyName = $dbval['companyname']; $response->getQuoteReturn->volume = $dbval['volume']; $response->getQuoteReturn->price = $dbval['price']; $response->getQuoteReturn->open = $dbval['open1']; $response->getQuoteReturn->low = $dbval['low']; $response->getQuoteReturn->high = $dbval['high']; $response->getQuoteReturn->change = $dbval['change1']; } $db->CloseDatabase(); } } else { $response = connectivityResponse(); } return $response; } /** * This is the utility method that update Account profile information. * @param profileInfo information that needs to be updated in the profile. * @return a AccountProfileDataBean object. */ function processUpdateAccountProfile($profileInfo) { $db = GetDatabase(); $response = null; if($db) { $query = "UPDATE accountprofile SET address='$profileInfo->address', password='$profileInfo->password', email='$profileInfo->email', creditcard = '$profileInfo->creditCard', fullname='$profileInfo->fullName' WHERE userid= '$profileInfo->userID'"; $result = $db->ExecuteQuery($query); if($result) { $response = new updateAccountProfileResponse(); $response->updateAccountProfileReturn = new AccountProfileDataBean(); $response->updateAccountProfileReturn->userID = $profileInfo->userID; $response->updateAccountProfileReturn->password = $profileInfo->password; $response->updateAccountProfileReturn->fullName = $profileInfo->fullName; $response->updateAccountProfileReturn->address = $profileInfo->address; $response->updateAccountProfileReturn->email = $profileInfo->email; $response->updateAccountProfileReturn->creditCard = $profileInfo->creditCard; } else { } $db->CloseDatabase(); } return $response; } /** * Is used to process a logout request * @param userID userID * @return logoutResponse object */ function processLogout($userID) { $db = GetDatabase(); $response = null; if($db) { $query = "UPDATE account SET logoutcount = (logoutcount + 1) WHERE profile_userid= '$userID'"; $result = $db->ExecuteQuery($query); if($result) { $response = new logoutResponse(); } $db->CloseDatabase(); } return $response; } /** * This method is used to get the holdings of a particular user. * @param userID userID * @return an array of HoldingDataBean objects. */ function processGetHoldings($userID) { $db = GetDatabase(); $response = null; if($db) { $query = "SELECT holding.holdingid, holding.quantity, holding.purchaseprice, holding.purchasedate, holding.quote_symbol,holding.account_accountid FROM holding WHERE holding.account_accountid = (SELECT accountid FROM account WHERE profile_userid = '$userID') ORDER BY holding.holdingid DESC"; $result = $db->ExecuteQuery($query); if($result) { $response = new getHoldingsResponse(); $response->getHoldingsReturn = new ArrayOfHoldingDataBean(); $rawNo = 0; while(($dbval = $db->GetSQLValue($result))) { $holdingID = $dbval['holdingid']; $response->getHoldingsReturn->HoldingDataBean[$rawNo] = new HoldingDataBean(); $response->getHoldingsReturn->HoldingDataBean[$rawNo]-> holdingID = $holdingID; $response->getHoldingsReturn->HoldingDataBean[$rawNo]-> quantity = $dbval['quantity']; $response->getHoldingsReturn->HoldingDataBean[$rawNo]-> purchasePrice = $dbval['purchaseprice']; $response->getHoldingsReturn->HoldingDataBean[$rawNo]-> purchaseDate = formatDate($dbval['purchasedate']); $response->getHoldingsReturn->HoldingDataBean[$rawNo]-> quoteID = $dbval['quote_symbol']; $rawNo = $rawNo + 1; } } $db->CloseDatabase(); } return $response; } /** * This method obtains the set of closed orders. * @param userID userID * @return an array of OrderDataBean objects */ function processGetClosedOrders($userID) { $db = GetDatabase(); $response = null; if ($db) { $query = "SELECT orderid, ordertype, orderstatus, completiondate, opendate, quantity, price, orderfee, quote_symbol FROM orders WHERE account_accountid = (SELECT accountid FROM account WHERE profile_userid = '$userID') AND orderstatus = 'closed'"; $result = $db->ExecuteQuery($query); if ($result) { $response = new getClosedOrdersResponse(); $response->getClosedOrdersReturn = new ArrayOfOrderDataBean(); $rawNo = 0; while(($dbval = $db->GetSQLValue($result))) { $orderID = $dbval['orderid']; $response->getClosedOrdersReturn->OrderDataBean[$rawNo] = new OrderDataBean(); $response->getClosedOrdersReturn->OrderDataBean[$rawNo]-> orderID = $orderID; $response->getClosedOrdersReturn->OrderDataBean[$rawNo]-> orderType = $dbval['ordertype']; $response->getClosedOrdersReturn->OrderDataBean[$rawNo]-> orderStatus = $dbval['orderstatus']; $response->getClosedOrdersReturn->OrderDataBean[$rawNo]-> completionDate = formatDate($dbval['completiondate']); $response->getClosedOrdersReturn->OrderDataBean[$rawNo]-> openDate = formatDate($dbval['opendate']); $response->getClosedOrdersReturn->OrderDataBean[$rawNo]-> quantity = $dbval['quantity']; $response->getClosedOrdersReturn->OrderDataBean[$rawNo]-> price = $dbval['price']; $response->getClosedOrdersReturn->OrderDataBean[$rawNo]-> orderFee = $dbval['orderfee']; $response->getClosedOrdersReturn->OrderDataBean[$rawNo]-> symbol = $dbval['quote_symbol']; $rawNo = $rawNo + 1; } $query = "UPDATE orders SET orderstatus = 'completed' WHERE orderstatus = 'closed' AND account_accountid = (SELECT accountid FROM account WHERE profile_userid = '$userID')"; $db->ExecuteQuery($query); } $db->CloseDatabase(); } return $response; } /** * This method is a utility method which obtains the AccountProfileData of * a user. * @param userID userID * @return an AccountProfileDataBean object. */ function processGetAccountProfileData($userID) { $db = GetDatabase(); $response = null; if($db) { $query = "SELECT accountprofile.userid, accountprofile.password, accountprofile.fullname, accountprofile.address, accountprofile.email, accountprofile.creditcard FROM accountprofile WHERE accountprofile.userid = '$userID'"; $result = $db->ExecuteQuery($query); if($result) { $response = new getAccountProfileDataResponse(); $response->getAccountProfileDataReturn = new AccountProfileDataBean(); $dbval = $db->GetSQLValue($result); $response->getAccountProfileDataReturn->userID = $userID; $response->getAccountProfileDataReturn->password = $dbval['password']; $response->getAccountProfileDataReturn->fullName = $dbval['fullname']; $response->getAccountProfileDataReturn->address = $dbval['address']; $response->getAccountProfileDataReturn->email = $dbval['email']; $response->getAccountProfileDataReturn->creditCard = $dbval['creditcard']; } $db->CloseDatabase(); } return $response; } /** * This method is used to get the Account data of a particular user. * @param userID userID * @return an AccountDataBean object */ function processGetAccountData($userID) { $db = GetDatabase(); $response = null; if($db) { $query = "SELECT account.accountid, account.profile_userid, account.creationdate, account.openbalance, account.logoutcount, account.balance, account.lastlogin, account.logincount FROM account WHERE account.profile_userid = '$userID'"; $result = $db->ExecuteQuery($query); if ($result) { $response = new getAccountDataResponse(); $response->getAccountDataReturn = new AccountDataBean(); $dbval = $db->GetSQLValue($result); $response->getAccountDataReturn->accountID = $dbval['accountid']; $response->getAccountDataReturn->profileID = $dbval['profile_userid']; $response->getAccountDataReturn->creationDate = formatDate($dbval['creationdate']); $response->getAccountDataReturn->openBalance = $dbval['openbalance']; $response->getAccountDataReturn->logoutCount = $dbval['logoutcount']; $response->getAccountDataReturn->balance = $dbval['balance']; $response->getAccountDataReturn->lastLogin = formatDate($dbval['lastlogin']); $response->getAccountDataReturn->loginCount = $dbval['logincount']; } $db->CloseDatabase(); } return $response; } /** * This method is used to get the orders that a particular user has placed. * @param userID userID * @return an array of OrderDataBean objects. */ function processGetOrders($userID) { $db = GetDatabase(); $response = null; if($db) { $query = "SELECT orderid, ordertype, orderstatus, opendate, completiondate, quantity, price, orderfee, quote_symbol FROM orders WHERE orders.account_accountid = (SELECT account.accountid FROM account WHERE account.profile_userid = '$userID') ORDER BY orders.orderid DESC"; $result = $db->ExecuteQuery($query); if($result) { $response = new getOrdersResponse(); $response->getOrdersReturn = new ArrayOfOrderDataBean(); $rawNo = 0; while(($dbval = $db->GetSQLValue($result))) { $orderID = $dbval['orderid']; $response->getOrdersReturn->OrderDataBean[$rawNo] = new OrderDataBean(); $response->getOrdersReturn->OrderDataBean[$rawNo]-> orderID = $orderID; $response->getOrdersReturn->OrderDataBean[$rawNo]-> orderType = $dbval['ordertype']; $response->getOrdersReturn->OrderDataBean[$rawNo]-> orderStatus = $dbval['orderstatus']; $response->getOrdersReturn->OrderDataBean[$rawNo]-> openDate = formatDate($dbval['opendate']); $response->getOrdersReturn->OrderDataBean[$rawNo]-> completionDate = formatDate($dbval['completiondate']); $response->getOrdersReturn->OrderDataBean[$rawNo]-> quantity = $dbval['quantity']; $response->getOrdersReturn->OrderDataBean[$rawNo]-> price = $dbval['price']; $response->getOrdersReturn->OrderDataBean[$rawNo]-> orderFee = $dbval['orderfee']; $response->getOrdersReturn->OrderDataBean[$rawNo]-> symbol = $dbval['quote_symbol']; $rawNo = $rawNo + 1; } } $db->CloseDatabase(); } return $response; } /** * This method is used to process a login request. * @param userID userID * @param password password * @return an AccountDataBean object. */ function processLogin($userID, $password) { $db = GetDatabase(); $response = null; if ($db) { $query = "SELECT accountprofile.userid, accountprofile.password, accountprofile.fullname, accountprofile.address, accountprofile.email, accountprofile.creditcard FROM accountprofile WHERE accountprofile.userid = '$userID'"; $result = $db->ExecuteQuery($query); $dbval = $db->GetSQLValue($result); if ($dbval['password']) { $query = "UPDATE account SET logincount = (logincount + 1), lastlogin = CURRENT_TIMESTAMP WHERE profile_userid = '$userID'"; $result = $db->ExecuteQuery($query); $query = "SELECT account.accountid, account.creationdate, account.openbalance, account.logoutcount, account.balance, account.lastlogin, account.logincount FROM account WHERE account.profile_userid = '$userID'"; $result = null; $result = $db->ExecuteQuery($query); if ($result) { $response = new loginResponse(); $response->loginReturn = new AccountDataBean(); $dbval = $db->GetSQLValue($result); $response->loginReturn->accountID = $dbval['accountid']; $response->loginReturn->creationDate = formatDate($dbval['creationdate']); $response->loginReturn->openBalance = $dbval['openbalance']; $response->loginReturn->logoutCount = $dbval['logoutcount']; $response->loginReturn->balance = $dbval['balance']; $response->loginReturn->lastLogin = formatDate($dbval['lastlogin']); $response->loginReturn->loginCount = $dbval['logincount']; $response->loginReturn->profileID = $userID; } } $db->CloseDatabase(); } return $response; } /** * This function formats the incoming date into the format * yy-mm-ddThh-min-sec format */ function formatDate($dateString) { return date ("Y-m-d\TH:i:s.100", strtotime($dateString)); } ?>