I'm building a project in PHP which the system sends a curl
request to another domain for processing a query. Eg. http://domain.com/process_query?q=abc
. The process_query
controller executes the query against a set of files and returns the summary results of individual files in the following format.
[
array('filename' => "one.dat", 'summary_counts' => 5),
array('filename' => "two.dat", 'summary_counts' => 30),
array('filename' => "three.dat", 'summary_counts' => 4),
array('filename' => "four.dat", 'summary_counts' => 70),
array('filename' => "five.dat", 'summary_counts' => 0)
]
It is then captures by the system which sent the curl request and renders it on the screen. I wish to do this in a progressive way. Like, as soon as the process_query
controller completes processing a file, it should be able to echo
the response [array('filename' => "one.dat", 'summary_counts' => 5)
] and continue processing the next file. If this is possible, for every response received the system can show a progressive query processing. Can this be achieved using PHP-curl
. If not what is the best alternative way?