Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8767575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T16:51:02+00:00 2026-06-13T16:51:02+00:00

Yes, I know the title is confusing enough, but here is what I want

  • 0

Yes, I know the title is confusing enough, but here is what I want to do:

I have created 3 websites (for clients. I have no control over them). All of these sites load a certain page of my main website. (with PHP file_get_contents – lets name it http://www.mainsite/x.php).

The problem here is the bandwidth. I’d like the 10 websites to create some temporary local file with that x.php file, rather then load the http://www.mainsite/x.php file every time. However I may make some changes to that x.php file so the local file should update itself every week or so.

Again what I mean is:
website 1,2 and 3 has a PHP file_get_contents of http://www.mainsite/x.php. On first load it should create a x.html file with the contents of x.php (i.e: http://www.website1/x.html). After a week website 1,2 and 3 should load http://www.mainsite/x.php again and create a new x.html file if changes have been made to the http://www.mainsite/x.php file.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T16:51:04+00:00Added an answer on June 13, 2026 at 4:51 pm
    public function generateTempFile(){
        $path = 'YOUR PATH';
        $original_path = 'YOUR ORIGINAL PATH WHICH you can change';
    
        if(file_exists($path)){
            $file_created_time = filemtime($path);
            if($file_created_time + 24*60*60 > time()){
                return TRUE;
            }
        }
        $string = file_get_contents($original_path);
        return file_put_contents($path, $string);   
    }
    

    This function will check the file last modification and if its more than 24 hours it will rewrite it.. To start it just run it from a cron task or put it inside your code at some page which is openned each day to be sure that it will be runned..

    At $string you have to set file new content and you can do that with file_get_contents() from other file.. OR just generate some string at custom..

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Yes I know, this title isn't really helpfull but this is the exact problem.
I have the following code (Yes I know it's quite long winded, but I
Yes, the title is confusing, but I will keep this simple. Imagine a photo
As title implies. Yes, i know it's horribad to use .abort() but hear me
Yes, I know that in ASP.NET MVC you have to use ViewModels. But I'm
(Yes I know I can call Java code from Scala; but that is pointless;
Ok so I start coding websites (yes I know I am almost 15 years
I´m trying to code a tooltip (Yes I know, I have my reasons to
I have an AXIS2/JAX-WS web service using a code first implementation (yes I know,
I want to develop a web application, like an online scheduler. (Yes I know

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.