Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have seen some websites that let you submit a file, then they say "Please check back in 20 minutes and your file will be processed". So the user sends a request to the server, then the server processes it in the background.
How is this done? Specifically, how is this done in PHP?
It can be done by calling a service working independently. For example you can do something like this:
send a request to the service to start processing something (service return an ID of started process)
after some time you ask service again about process status (you need to send an ID of the process)
if service still working then you get an information about it
if service has finish then you can get a result from it
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
I'm new to Laravel, I want to update the interface every time there is a change in the database but I think calling a JavaScript every 5s to update the interface is not very efficient, so I wonder what is the most efficient way to do that?
Have you considered using some for of websocket to create a connection between your backend and JavaScript based UI?
Either https://laravel.com/docs/master/broadcasting or https://github.com/beyondcode/laravel-websockets would allow you to notify your UI to request the updates from your Laravel backend.
My personal suggestion would be that you JS would receive a notification that something had changed and then have to obtain the updated information via Ajax so that you are not sending confidential information through Pusher's servers.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
i have a website where you click on a tomato and get points based on how many times you've klicked on it. The problem is that it's all running on php and AJAX requests. Every 10 seconds an request is sent on how many clicks the user has now, and the server updates. So in theory a user could just send requests of them having 30000 clicks and it would register. A friend of mine said that i should use node and register every click individualy with a socket, but everything so far is running on php. Is there a way to open a node server and make it talk with php?
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
The Story
I am using NotificationPusher that uses GCM to send notification to user.
It takes some time to connect to google server and wait for response.
So, I don't want my user to wait until notification is sent, I want him to get the response (say that he successfully commented on a post).
Then, -After response- the notification is sent to the user whom post is commented on.
How to do that, I am getting crazy.
You may use queue. When user comment post, add event to queue.
Queue is parsed by cron (using Laravel's command).
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I want to run a php function on my server in a certain time without make the script sleep.
I need this in order to update my database in specific time.
For example a chat room that lasts for 5 minutes.
The chat room have a flag in the database for open status.
I want to change the flag in the database to close after 5 minutes.
public function callOnDelay($time, $data)
{
//SOME CODE EXECUTED AFTER SOME TIME IS OVER//
}
There are different ways of doing this depending on your OS.
On Linux you can look for Cron Jobs (http://www.thesitewizard.com/general/set-cron-job.shtml).
On Windows you can look for Task Scheduler (http://technet.microsoft.com/en-us/library/cc766428.aspx).
Also another, not so reliable, method of doing this is adding a conditional/if in your main script (index.php ?) or a "before function" in your controller (if you are using some kind of framework that supports it) and checking for the last status and doing something with it.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
i want to know how much time a visitor stays on my website..??? can it be done with any online services ??..Any help would be appreciated..
Use Google analytics http://www.google.com.au/analytics/
A session can only change every time you call set or reset it.
But if you wanted to, you could use jQuery ajax, to run a script every X seconds or mins. Then in the file that you are ajax'ing in. Change your session data.
You will find analytics make a new request every time the user does something. Like moves the mouse, clicks on something, etc. So you would have to set up some js to do that as well.