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!
To do it the way you have you would do this, probably using
http_build_queryHowever, I would be curious to know why you are choosing to use wget over cURL or, if the file is on the same server, calling it directly. It seems a bit clumsy to use wget for this.