Location: PHPKode > scripts > Handle remote data with PHP 5 and REST Web service > handle-remote-data-with-php-5-and-rest-web-service/server/restserver_showall.php
<?php
	// check if classes are valid
	$strKlasse = '';
	function __autoload($strKlasse)
	{	try {	if(!preg_match('=^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$=m',$strKlasse))
		{ throw new Exception("Class '$strKlasse' is not valid."); }
		$strIncludeFile = 'classes/'.$strKlasse. '.class.php';
		if (!file_exists($strIncludeFile))
		{ throw new Exception("Include file <i>$strIncludeFile</i> not found.<br>"); }
		require_once($strIncludeFile);
		if(!class_exists($strKlasse))
		{ throw new Exception("Include file <i>$strIncludeFile</i>
							contains no class '$strKlasse'.<br>");	}
		return true; }
		catch(Exception $e)
		{ die($e->getMessage()); }
	}

	// set class instance for error handling
	$processallusers = new ServerMainContent();

	$action = '';
	$id = '';

	$action = $_POST['action'];
	$id = $_POST['id'];

	// determine action based on POST
	if(isset($action)
		&& $action == 'doshowall'
		&& !isset($id)) {

		// set variable for specific submission action and class instance
		echo $processallusers->showAllRemoteRecords();
	}
	elseif (isset($action)
		&& $action == 'doshowsingle'
		&& isset($id)) {
		// set variable for specific submission action and class instance
		echo $processallusers->showSingleRemoteRecord($id);
	}
	else {
		echo $processlogin->get_error();
	}

  ?>
Return current item: Handle remote data with PHP 5 and REST Web service