generate a Unix timestamp into a *.php file

December 12, 2010 at 20:13:46
Specs: Windows 7
I have some php files I'm using to pull product feeds from my distributor. In order for the update to work properly, I have to submit a Unix time stamp every time I run the php file so I can get stock quantities that have changed every 15 min or whatever I choose. It currently runs from a cron job every 15 min.

Inside the importproducts.php file, this code gets the data:

$myFeed = 'http://www.*****.com/feeds/productdownload.php?id=**************&version=2&format=xml&fields=sku,qty&time=';

If I don't include a Unix time stamp, I will get everything every time. This I don't want!

So what I am wondering is, can I use some code that would fill in the Unix time stamp after the (&time=?) part before the file actually runs?

See More: generate a Unix timestamp into a *.php file

Report •

January 24, 2011 at 08:02:50
so you want to populate $_GET['time''] with the unix timestamp but you want to do this before the productdownload.php script is run? I suspect the best way for you to do this would be to store the timestamp in a session variable which is then passed into a hidden form item called time or so it can be called using $_GET or $_REQUEST.

As for getting the timestamp i think something like time(); returns the timestamp. so

$now = time();
echo $now;

this will echo the timestamp. I reckon you will be able to get this sorted using this info, don't you?

Report •
Related Solutions

Ask Question