title: Change url of file_get_contents based on time
body: <p>$string = file_get_contents("<a href="http://domain.com/api/data?after=1412640000" rel="nofollow">http://domain.com/api/data?after=1412640000</a>");</p>
  
  <p>My PHP code displays the json data based on the epoch time. This time is always at 00:00:00 UTC. I need the time in the url to change at different time frames like 1 day when it is available.</p>
  
  <p>I can put a variable in the url to get the current time but Im lost on the setting it to 00:00:00 UTC for when the new day would roll over.</p>
  
  <p>Ive searched and I keeping getting partial results but not quite what I need. First time posting here. Thanks for the help.</p>
  
  <p>Edit: I got this to work for daily changes but I need two other time frames like one week and a month.</p>
  
  <p>Heres the code:</p>
  
  <pre><code>$daily = gmdate(strtotime('yesterday'));
  $string = file_get_contents("http://domain.com/api/data?after={$daily}");
  </code></pre>
  
  <p>The gmdate is what did the trick for UTC. Now for a week time frame. An example would be displaying the date of the 2nd of the month until the week rolls over then it displays the new weekly date from the 9th.</p>