0

I am making a REST call through PHP curl and in the response i am getting an url that url

opening in new tab . Now Here's my problem starts .

1) The url that i am getting from REST is basically a profile url so on that page a logout

option is present and while clicking on logout button i can notify to my REST client .

But suppose if user close the browser in that case how can i notify to my REST client .

Is there any way to do this .?

Any help would be appreciated.

Example : I make a REST call to http://somweb.com/hi?id=12

In the response i got a URL i.e http://someurl.net/user?id=19

Now i open the REST url(http://someurl.net/user?id=19) in a new tab to my local machine

Now Question is if user close the tab (REST returned tab )How can i notify to my REST client

Nags
  • 157
  • 4
  • 14

1 Answers1

0

May not be the sleekest solution, and it may not work for you but it can be done with a cronjob script and delayed events (not to be confused with browser events!!!).

When you open the url, write in you storage (db, file) that event should be triggered at certain time. If all goes well, delete the entry form storage and notify REST client. If user closes tab before it all completes, then event entry will not be deleted and cronjob script may be used to check for these entries and executes those that are overdue and deletes entries.

A cronjob can be setup to execute a script every minute or every few minutes. This may not be good solution since cronjob script should be executed very often and this may reduce your server performance, but if you think it is worth it - then go for it.

Hope this helps

Ivan Hušnjak
  • 3,493
  • 3
  • 20
  • 30