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

  • SEARCH
  • Home
  • 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 8619421
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T06:20:04+00:00 2026-06-12T06:20:04+00:00

I am stuck with a project, its a quick fix project & i need

  • 0

I am stuck with a project, its a quick fix project & i need some expert help on this please. My clients has two separate websites.

1. http://abc123.com/using-cron-job-update-this-folder.txt <-- I'm working on this
2. http://bw.aaaaaa.com/blah.txt                           <-- Client's 2nd site where some txt gets updated almost twice a day, on this folder blah.txt

I need a php snippet to execute a cronjob, i.e grab text from site2 - http://bw.aaaaaa.com/blah.txt, real time & update site1 - http://abc123.com/using-cron-job-update-this-folder.txt as soon as any text is updated on site 1.

  • 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-12T06:20:05+00:00Added an answer on June 12, 2026 at 6:20 am

    Though this will probably result in high server resource usage and is not very recommended, you can proceed the following way.

    1. The server that will grab the file from another server – let’s name it CLIENT.
    2. The server that will contain the new information to be copied by the CLIENT – let’s name it SERVER.

    On the CLIENT, create a PHP script that uses CURL to download the remote file’s headers only and more specifically the modify-date.

    The following answer provides a useful snippet.

    Store this date and the next time the script runs, check if it’s updated, then download the full source, including body and save it however you like (e.g. to a local txt file on the CLIENT).

    Again on the CLIENT, create a cronjob that will run every second or every 5 seconds or however often you like the content to be updated. This may come in handy for setting up the cronjob.

    Alternatively, you may create a single PHP script that will loop and do something (download the remote file) and sleep for 1 second, doing this for a total of 60 seconds then stopping. Combine this with a cronjob that runs every minute and you have yourself the same effect, without having a cron call to the CLIENT server every second. To see an implementation of this approach, see this question and its accepted answer.

    A better and recommended alternative is to use AJAX, which is run on the client side. Make it run as soon as the user’s mouse moves and pull date from the SERVER through an API you can expose on the SERVER’s side (e.g. one that will return data in JSON format, to be parsed by a JavaScript library like jQuery inside the user’s browser). The Facebook Wall is coded this way. If you just leave the Wall open in a background tab it doesn’t load any new content. As soon as you switch back to it and hover with the mouse the new posts are displayed.

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

Sidebar

Related Questions

Hey, I'm really stuck with my project here... I need to know when any
Im stuck with this little project in C# but basically my problem is this:
This was my first Sinatra project - link shortener but I am stuck with
I'm kinda stuck on this decision. My project already uses Spring and Spring Blazeds
I'm a wee bit stuck on this, and was hoping you might have some
I'm setting up some test scaffolding around an existing project. This includes some integration
My client has a database (TS) for a project I'm working on. This database
I'm working on a project and I'm stuck with this problem: I have a
I'm stuck with migrating my Django project to a production server. Here is the
I've stuck myself in a c++ project under linux ,for which I get an

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.