You can read here:
https://habrahabr.ru/company/devconf/blog/258979/
But probably easier to do via ajax not on server. Received the request to the php will render the page with the download, it launched ajax into a third-party server has received the data sent with ajax to the php, given the page with the download.
PS: c php7 have not yet understood, but met with info that there will be asynchronous.