scripting - PHP listener script that can read incoming $_REQUEST or $_POST variables -
i trying write php script listens incoming $_request or $_post variables sent web application part of 2-way communication.
http calls made web app in format similar this.
the webapp send post response listener script (http://travisng.com/listener.php) , wondering if php script parse without me executing php script manually?
note not referring writing script listens network requests on socket.
basically, want parse post data sent web app , write out log file. therefore, every time run listener script read log file , print out post responses sent listener script.
here's of code i've written:
<?php // read incoming post request if (!empty($_post)){ $params = join(" ", $_post); //print_r($params); echo "|$params|"; } // print params & timestamp file called listenerlog.txt $logfile = "http://travisng.com/listenerlog.txt"; $filehandle = fopen($logfile, 'a') or die("unable open listenerlog.txt."); fwrite($filehandle, $params); fclose($filehandle); $output = file_get_contents($logfile); // print listenerlog.txt //echo $output; ?>
cheers,
travis
to overcome issue, decided create cgi listener script , process request parameters there. cgi script invoked whenever get/post request came through , requests written out log file.
Comments
Post a Comment