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 7902559
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T09:31:51+00:00 2026-06-03T09:31:51+00:00

I am putting together an online radio station, and I am using Applescript to

  • 0

I am putting together an online radio station, and I am using Applescript to update my server with the “nowplaying” information that is ultimately coming from iTunes.
Applescript pushes that information to the server as a .html file.
That works fine, then I receive the information into my website using this line of php:

$fp = fopen ("music/rtl.txt","r"); 
if (!feof($fp) ) 
{ 
   $buffer = fgets($fp, 1024); 
   print "<tr><td align=\"center\"><b>Current Track</b>: $buffer"; 
} 
fclose ($fp);

My question is: how do I get this information to udpate automatically? Even though it is updating on the server, it will remain still until I hit refresh on the webpage.
How do I get this PHP information to refresh itself without having to manually refresh my screen? How can the Current Track information change automatically?

  • 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-03T09:31:52+00:00Added an answer on June 3, 2026 at 9:31 am

    First off, on your html page, use a span with an id to indicate the spot where you want the track info to go:

    //html page
    <tr><td align="center"><b>Current Track</b>: <span id="currentTrack"></span>";
    

    Then, assuming jquery is cool, use the ajax function inside a custom function, then use setInterval to run it every 5 seconds:

    //script page (using jquery)
    $(function(){
    
        setInterval(refreshTrack,5000); //  5 SECONDS
    
        function refreshTrack() {
            $.ajax({
                    type: 'post',
                    url: 'ajax.php',
                    success: function(txt) {
                        $('#currentTrack').text(txt);
                    }
                });
        }
    });
    

    And of course, your ajax page will look pretty much like what you’ve got, except take away the html markup, because what it spits out will go between the <span> tags:

    // ajax.php
    $fp = fopen ("music/rtl.txt","r"); 
    if (!feof($fp) ) 
    { 
       $buffer = fgets($fp, 1024); 
       echo $buffer; 
    } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm putting together a fixed, one-page site that deploys an overlay using jQuery. There
I'm interested in putting together my first online game using Flash as the client
I am having trouble putting together a script that lists various business contact information.
I am putting together a php script that pulls html using curl, copies it
I was putting together a website using the Comfortaa font from Google Web Fonts.
I'm putting together a simple test made up of two tutorials available online for
I putting together a page that will display a set of stored values. I
I am putting together a fairly simple web app that uses user inputted data
I am putting together a technical analysis library that I hope others may use
For putting together a site from scratch, what are the advantages and disadvantages of

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.