I am writing a PHP program and part of an XAMPP site that I have running on the localhost of my machine. I would like the file to input two of its strings into a Java program that I have saved on the desktop of my computer, and then store the output as a string. I have been trying to use shell_exec() but I have not gotten it to work.
Any tips?
<?php
$artist = $_POST['artist'];
$songname = $_POST['songname'];
$artist = preg_replace('/\s+/', '', $artist);
$songname = preg_replace('/\s+/', '', $songname);
$artist=strtolower($artist);
$songname=strtolower($songname);
echo $artist;
echo $songname;
$output = shell_exec("/Users/ianterry/Desktop/CussCalc2/java CussCalc '$artist' '$songname'");
$output = shell_exec("/usr/bin/java -version");
echo $output;
?>
So far, the only output I get when it is run is the two strings being echo'd.