veedub Posted April 26, 2007 Share Posted April 26, 2007 Hello! I have a PHP 'script1.php' that is basically a listener for another system that has a command writing to script1.php. Going on the basis I can't see the command that is posting to script1.php. I was wondering if there is a way in PHP to see the names and values of all things posted to it? cheers. Link to comment https://forums.phpfreaks.com/topic/48750-how-do-you-find-out-what-is-being-posted-to-a-php-script/ Share on other sites More sharing options...
taith Posted April 26, 2007 Share Posted April 26, 2007 you'd need to store that information into a database, when they're using that file... Link to comment https://forums.phpfreaks.com/topic/48750-how-do-you-find-out-what-is-being-posted-to-a-php-script/#findComment-238924 Share on other sites More sharing options...
veedub Posted April 26, 2007 Author Share Posted April 26, 2007 thanks for the reply. That isn't possible on the side that is posting the data. I thought there might be a trick in PHP to do this? I can count the number of values being posted to the script by doing the following: for($x=0;$x<count($_POST);$x++{ $field = $_POST[$x]; // do some action } Link to comment https://forums.phpfreaks.com/topic/48750-how-do-you-find-out-what-is-being-posted-to-a-php-script/#findComment-238938 Share on other sites More sharing options...
trq Posted April 26, 2007 Share Posted April 26, 2007 <?php foreach($_REQUEST as $k => $v) { echo "The key '$k' has a value of '$v'\n"; } ?> Link to comment https://forums.phpfreaks.com/topic/48750-how-do-you-find-out-what-is-being-posted-to-a-php-script/#findComment-238945 Share on other sites More sharing options...
AndyB Posted April 26, 2007 Share Posted April 26, 2007 If you have a script running on your server that is accepting data from offsite AND it's acting on the information, then clearly your script is able to 'see' the information otherwise it wouldn't do anything. Unless Thorpe's code meets your needs, you'll need to be a bit more descriptive about what you really want. Link to comment https://forums.phpfreaks.com/topic/48750-how-do-you-find-out-what-is-being-posted-to-a-php-script/#findComment-238947 Share on other sites More sharing options...
veedub Posted April 26, 2007 Author Share Posted April 26, 2007 Nice on Thorpe that's exactly what i wanted! cheers Link to comment https://forums.phpfreaks.com/topic/48750-how-do-you-find-out-what-is-being-posted-to-a-php-script/#findComment-238955 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.