Php program should suspend execution till jsonobj received

I have a php program which processes and displays data based on a json object received from a website xxx. The xxx website posts the data as a json object. Since php cannot open a browser window (all on server) I need to execute the php code in a browser on my client. However, I am unable to make the php program wait till the json object is posted by the xxx website web hook. Since the php code processes jsondata received from the website xxx and displays an html page of these results, I get an error as soon as I open the php code in a browser
I have tried opening browser window through javascript within the php code but does not work