$lineItemService = $user->GetService('LineItemService', 'v201311'); // Set the ID of the order to get line items from. $orderId = 'INSERT_ORDER_ID_HERE'; // Calculate time from three days ago. $threeDaysAgo = date(DateTimeUtils::$DFP_DATE_TIME_STRING_FORMAT, strtotime('-3 day')); // Create bind variables. $vars = MapUtils::GetMapEntries(array('orderId' => new NumberValue($orderId), 'threeDaysAgo' => new TextValue($threeDaysAgo))); // Create statement object to only select line items belonging to the order // and have been modified in the last 3 days. $filterStatement = new Statement("WHERE orderId = :orderId " . "AND lastModifiedDateTime >= :threeDaysAgo " . "LIMIT 500", $vars); // Get line items by statement. $page = $lineItemService->getLineItemsByStatement($filterStatement); // Display results. if (isset($page->results)) { $i = $page->startIndex; foreach ($page->results as $lineItem) { // Format lastModifiedDateTime for printing. $lastModifiedDateTime = DateTimeUtils::GetDateTime($lineItem->lastModifiedDateTime); $lastModifiedDateTimeText = $lastModifiedDateTime->format(DateTimeUtils::$DFP_DATE_TIME_STRING_FORMAT); print $i . ') Line item with ID "' . $lineItem->id . '", belonging to order ID "' . $lineItem->orderId . '", with name "' . $lineItem->name . '", and last modified ' . $lastModifiedDateTimeText . " was found.\n"; $i++; } } print 'Number of results found: ' . $page->totalResultSetSize . "\n"; } catch (OAuth2Exception $e) { ExampleUtils::CheckForOAuth2Errors($e); } catch (ValidationException $e) { ExampleUtils::CheckForOAuth2Errors($e); } catch (Exception $e) { print $e->getMessage() . "\n"; }