KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am working on an a PHP web application and i need to perform some network operations in the request like fetching someone from remote server based on user's request. Is it possible to simulate asynchronous behavior in PHP given that i have to pass some data to a function and also need output from it. My code is like: <?php $data1 = processGETandPOST(); $data2 = processGETandPOST(); $data3 = processGETandPOST(); $response1 = makeNetworkCall($data1); $response2 = makeNetworkCall($data2); $response3 = makeNetworkCall($data3); processNetworkResponse($response1); processNetworkResponse($response2); processNetworkResponse($response3); /*HTML and OTHER UI STUFF HERE*/ exit; ?> Each network operation takes around 5 seconds to complete adding a total of 15 seconds to the response time of my application given i make 3 requests. The makeNetworkCall() function just do a HTTP POST request. The remote server is an 3rd party API so i don't have any control over there. PS: Please do not answer giving suggestions about AJAX or Other things. I am currently looking if i can do this through PHP may be with an C++ extension or something like that.
Tags (comma-separated)
Save Edits
Cancel