Asynchronous web service in PHP

I get information from some web services, but I would like the methods that I call to be asynchronous simply because the request takes so much time for the site to load slowly.

I am currently using a regular SOAP call

$client = new SoapClient("http://xxxx.com/webservices/json.asmx?WSDL");

$result = $client->__soapCall($id, $parameters);

Can anybody help me?

+4
source share
3 answers

The usual approach for this is not an asynchronous strategy, only on the server side, as this does not match the way php works. Instead, this strategy applies:

html- , , API. . , , javascript, . ajax , , API, . , ajax, html .

, / API . , , , , .

, , API . , , ajax . , ajax, . , .

, , php. . , API. ajax API .

+1

- php. Script , , . - ( ), .

https://en.wikipedia.org/wiki/Service-oriented_architecture

"" , , () .

, ( ), . ($ client = new SoapClient (...) script.

0

, - .

, Ajax . , , Redis beanstalkd.

api, script ,

shell_exec('PHP .php someargs >/dev/null 2>&1 &');

, .

0

Source: https://habr.com/ru/post/1598554/


All Articles