[FX.php List] Monitoring WPE connection

Tim 'Webko' Booth tim at nicheit.com.au
Wed Aug 24 20:02:37 MDT 2011


Dear Bob,
>
> Ah I see what you are trying to do... alert yourself from an FX page  
> if it doesn't load correctly.

Well, you can make a call from a page to check if Port 80 is  
responding on the remote server and do something then before FX is  
invoked - I do use that for some checks, but I think only on a single  
machine deployment.

<?php

// Insert valid hostname, user, password, database name and layout in  
the database (lines 5, 9, 10, 11 & 24)
	$dbHost='xxx.xxx.com.au';		//Database IP
	$port='80';						//Webserver Port
	$dbType='FMPro7';					//For FMPro7
	$conType='HTTP';					//Connection Type
	$dbUser='web_user';					//Database User Name
	$dbPass='password';					//Database Password
	$dbName='Database';			//Database Name

	include_once('FX/FX.php');	// FX.php file

	//Simple server tests
	$_SESSION['serverError'] = ""; // reset server error
	//Check if Port 80 works at all
	if( !fsockopen ($dbHost, 80, $errno, $errstr, 2) )	{
		$_SESSION['serverError'] = "Server not up";
	} else {
		//Check if a findany to an available table works
		$pageObj=new FX($dbHost,$port,$dbType,$conType);
		$pageObj -> setDBPassword($dbPass,$dbUser);
		$pageObj -> setDBData($dbName,'VALID LAYOUT NAME', 'all');
		$pageData = $pageObj -> FMFindAny();
		$_SESSION['serverError'] = $pageData['errorCode'];
	}
	if ($_SESSION['serverError'] != "0") {
		echo "Error: ".$_SESSION['serverError'];
	}
?>




More information about the FX.php_List mailing list