[ Jocelyn Ireson-Paine's Home Page
| How to Call SWI-Prolog from
PHP
]
Running a PHP Session with Prolog
session_start();
if(isset($_SESSION['views'])) {
$views_so_far = $_SESSION['views'];
$goal = "test($views_so_far)";
$cmd = "nice -n15 /software/bin/pl -f /home/popx/www.j-paine.org_cgi-bin/test2.pl -g \"$goal,halt\"";
$output = shell_exec( $cmd );
list($english_state,$prolog_state) = split ("==========", $output, 2);
echo $english_state;
$_SESSION['views'] = $prolog_state;
}
else
$_SESSION['views'] = 1;
?>