I need to write a php script, that will do a POST request to my PhantomJs server, and call some callback function after receiving response.
Let's say this is my phantomjs server :
var server, service;
server = require('webserver').create();
service = server.listen(8080, function (request, response) {
//do_something_heavy_with_request_data_here
response.statusCode = 200;
response.write("{status: success, data: data}");
response.close();
});
So from my php script I need to do a request to http://localhost:8080
and when phantomjs finishes it's calculations and sends response, fire a callback function.
I've found this topic : How do I make an asynchronous GET request in PHP? . Anything useful here ? I was thinking about this curl approach, but not sure how to get all of this running together since I'm a total php beginner : How do I make an asynchronous GET request in PHP? .