Update when page updates

Proximity

IDK?
Feb 13, 2014
673
56
Hello,

I was wondering how I could reload a div when ever a XML file changes it's content (Shoutcast)

So I don't have to have a reload every x seconds just update it when the song changes.
 

Jaden

not so active
Aug 24, 2014
886
263
Hello,

I was wondering how I could reload a div when ever a XML file changes it's content (Shoutcast)

So I don't have to have a reload every x seconds just update it when the song changes.
for Node.js

I don't think this can be done in PHP, but they're other options.
 

Ecko

23:37 [autobots] -!- eckostylez [[email protected]]
Nov 25, 2012
1,396
960
He said he didn't want it to reload after x amount of seconds...
He wants to reload a div whenever an XML file changes its content, not just every 'x' seconds.

It is going to have to be scripted so that it checks every 'x' seconds. He will need to store the current XML data in one variable prior to the check, and then again in another variable after the check. He can then compare the XML data to see if it has been changed and reload the div accordingly.
 

Jaden

not so active
Aug 24, 2014
886
263
He wants to reload a div whenever an XML file changes its content, not just every 'x' seconds.

It is going to have to be scripted so that it checks every 'x' seconds. He will need to store the current XML data in one variable prior to the check, and then again in another variable after the check. He can then compare the XML data to see if it has been changed and reload the div accordingly.
Nope, aren't you a Linux SysAdmin? And you're unfamiliar with the command "tail"?
Sadly that's the only way no matter how you do it. Hell, making a custom desktop application would still mean you'd have to poll it every x amount of seconds.
No, you wouldn't have to poll if you used a desktop application because his OS has functions that can establish listeners that call back to a function after a certain file is updated.

ONT:
PHP inotify is exactly what you're looking for.
 
Last edited:

Ecko

23:37 [autobots] -!- eckostylez [[email protected]]
Nov 25, 2012
1,396
960
Nope, aren't you a Linux SysAdmin? And you're unfamiliar with the command "trail"?

No, you wouldn't have to poll if you used a desktop application because his OS has functions that can establish listeners that call back to a function after a certain file is updated.

ONT:
PHP inotify is exactly what you're looking for.
Never heard of trail. Think you mean tail:

Don't even see how that even applies here, since using tail with follow will not detect any changes on a line it has already tailed:
Code:
root@autobots [~]# touch jadenisanidiot && echo 'dumbass' >> jadenisanidiot
root@autobots [~]# screen
[detached]
root@autobots [~]# sed -i 's/dumbass/retard/' jadenisanidiot
root@autobots [~]# cat jadenisanidiot
retard
root@autobots [~]# screen -r
root@autobots [~]# tail -f jadenisanidiot
dumbass
It would be stupid to use PHP for this when JS would work fine.
 

M8than

yes
Mar 16, 2012
463
102
Nope, aren't you a Linux SysAdmin? And you're unfamiliar with the command "tail"?

No, you wouldn't have to poll if you used a desktop application because his OS has functions that can establish listeners that call back to a function after a certain file is updated.

ONT:
PHP inotify is exactly what you're looking for.
Are you just pretending to be stupid?
The XML file is on a remote server. On top of that all tail does is poll a file...?
 

Weasel

👄 I'd intercept me
Nov 25, 2011
4,132
2,456
GTFO off my thread if you ain't got nothing to share/give that is positive or helpful give the fuck off my thread.
Actually, he's right. They helped you to figure it out for yourself. If you want to be spoon-fed (as you literally are asking to do, you haven't even tried yourself, you just asked for code) post a thread here:

So yeah, fuck off yourself m8.
 

Proximity

IDK?
Feb 13, 2014
673
56
Actually, he's right. They helped you to figure it out for yourself. If you want to be spoon-fed (as you literally are asking to do, you haven't even tried yourself, you just asked for code) post a thread here:

So yeah, fuck off yourself m8.

I did figure it out.
 
Feb 1, 2014
165
137
There are multiple ways, most common is simply polling and using AJAX. Although you're better off experimenting with WebSockets (if available) which are much faster.
I'm a bit worried with some responses to this post, such a task should always be client-side via JavaScript...
 

Users who are viewing this thread

Top