0

I am taking the result from Prolog to PHP and I want to send it to Android as a string ($output).

Any idea what I must write to Android? And should I change my PHP code? This is my PHP code:

    <?php
    $cmd = "\"c:/program files/swipl/bin/swipl.exe\" -f my_project.pl -g 
    \"prove([activity(X)],D),writeln(X),write(D),halt\""; 
    $output = shell_exec($cmd); 
    print_r($output);
    ?>

print_r($output) is printed this result which is correct, is what I want:

walk [nott(rec_walk),pr7,rec_walk,weatherrr(good),a3(walk)]
Benjamin W.
  • 46,058
  • 19
  • 106
  • 116
  • 1
    You can't really "send it to android" (technically you can, but very difficult and limited) from PHP. You will need to "ask" from "android". – Barns Jan 15 '18 at 17:24
  • You could send it as a push notification. – nasch Jan 17 '18 at 12:20
  • Unless you want a keep a list of devices interested in the result and broadcast it to them, I'd advice setting up a web controller which runs the PHP code and returns the result as JSON text, then have your android program send a simple request for the URL. Broadcasting is really not desirable as you have no direct control over when it broadcasts and whether devices are still listening. It is much easier to have the device check whether something is updated yet at a set interval, or at a user command. Check [http](https://stackoverflow.com/questions/3505930/make-an-http-request-with-android) – G_V Jan 17 '18 at 13:34

0 Answers0