How to transfer a file between two sites on yii2 (rest+json)?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
6 views
Hello, dear programmers)

The task - it is necessary from one project to yii2 upload file to another project also in yii2. The point is that the file CANNOT be transferred in the open (ie give a link to the file, and the second project kurlon or anything to download).

I kinda dug up this way:
Yii::$app->response->sendFile($path, $model->file ['mimeType'=>'application/zip']);


But how can I make the second server the whole thing?)

...MB something like this? But cheto not)
private function download($url, $file) { $myFile = @fopen($file, "w"); $resource = curl_init(); curl_setopt($resource, CURLOPT_URL, $url); curl_setopt($resource, CURLOPT_FILE, $myFile); curl_setopt($resource, CURLOPT_HEADER, 0); curl_exec($resource); curl_close($resource); fclose($myFile); }


Question add one important detail.
"Loading-file-in-framework-rest-json-concept"
by | 6 views

3 Answers

0 like 0 dislike
by
0 like 0 dislike
by
0 like 0 dislike
If anything further is to use, and to use only Yii, you are doing the receiver a special controller with action, which will POST a file from the source site.
by

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
4 answers
asked Mar 23, 2019 by bezumkin
0 like 0 dislike
1 answer
110,608 questions
257,186 answers
0 comments
35,430 users