I don't know if there is some name for this but what I want to create a script in php which runs in the background and capable of sending and receiving messages.
This is what I want to do exactly:
- Listen to a URL http://site1.com through xmpp protocol.
- Whenrever there is a message from site1.com, I should send it to http://site2.com as GET
- Listen to http://site2.com for a response (site2 may take >=30mins to respond to message we sent in step2)
- If a GET a response from site2.com, I should send the message to http://site1.com through xmpp.
This is what I've done:
- Using XMPPHP library, listening to site1.com consistenly through infite while loop.
- Whenver there is a message, i'm using file_get_contents() to push message to site2.com
- Now, I'm struck here. I don't how listen to this site2.com on GET now, as my script is already running and listening to site1.com
- Its easy to send a message to site1.com. The problem is only 3.
Any idea how I could solve this or any other alternative(better) way I could do this? Any help is appreciated.
PS: I don't have access to both site1.com and site2.com except thier urls for sending and receving.