Passing $_GET or $_POST data to PHP script that is run with wget
Posted
by
Matt
on Stack Overflow
See other posts from Stack Overflow
or by Matt
Published on 2010-12-24T17:01:12Z
Indexed on
2010/12/27
21:53 UTC
Read the original article
Hit count: 190
Hello,
I have the following line of PHP code which works great:
exec( 'wget http://www.mydomain.com/u1.php > /dev/null &' );
u1.php acts to do various types of maintenance on my server and the above command makes it happen in the background. No problems there.
But I need to pass variable data to u1.php before it's executed. I'd like to pass POST data preferably, but could accommodate GET or SESSION data if POST isn't an option. Basically the type of data being passed is user-specific and will vary depending on who is logged in to the site and triggering the above code. I've tried adding the GET data to the end of the URL and that didn't work.
So how else might I be able to send the data to u1.php? POST data preferred, SESSION data would work as well (but I tried this and it didn't pick up the logged in user's session data). GET would be a last resort.
Thanks!
© Stack Overflow or respective owner