Home>

Problem Next: Server Through the APIs gets files from another server by "order" of the client, downloads it yourself and then gives them to the client.

Question: Is it possible (if so, how) to remove the link in this chain, where the intermediary server first pumps itself, and then gives it to the client? That is, that the server is only authorized, got a token, and the client with a token downloaded himself directly through the browser.

Schema of receiving a file is such:

$ respjwt= $ this->
get_cookies (); //Tocken
        $ url= 'https://app.ru/api/documents/'.$doc_id.'/file';
        $ ch= curl_init ($ URL);
        CURL_SETOPT ($ CH, CURLOPT_HTTPGET, TRUE);
        CURL_SETOPT ($ CH, CURLOPT_RETURNTRANSFER, TRUE);
        CURL_SETOPT ($ CH, Curlopt_Httpheader, Array ($ Respjwt));
        CURL_SETOPT ($ CH, CURLOPT_VERBOSE, TRUE);
        $ FP= Fopen ($ Name, 'W');
        curl_setopt ($ CH, Curlopt_file, $ Fp);
        $ Data= CURL_EXEC ($ CH);
        CURL_CLOSE ($ CH);

and then the server redirects to the download page of this $ name file to the download page.

What prevents the client to ul in this code?

Alexey Ten2021-07-15 08:15:10

I do not know how in the href link to shove the Headers, where it lies jwt

Englio2021-07-15 08:15:10

Well, for example, a script on the client. What of the listed you can change at all?

Alexey Ten2021-07-15 08:15:10