How to get content of flies,which are at another server

Hi guys,

my intention is to get content of filles,which are physically not in any folder of webserver.

For instance, I have a file at my NAS-server(RaspberryPi),which has following Url:




\\192.168.1.10\Samba_Freigabe\Datensicherungen\pics\man_0.jpg



My Webserver still has Url 127.0.0.1

Originally, I will get content of files,which are in a folder, defined by database using this code:





 public function actionFile($filename, $id) {

	$model_folder = Dateianhang::findOne(['id' => $id]);

	$folder_read = AppEinstellung::getSpeicherOrt($model_folder);

	$folder_base = Yii::getAlias('@app');

	$folder_read = $folder_base . $folder_read;

	if (!is_file("$folder_read/$filename")) {

		$model = Dateianhang::findOne(['id' => $id]);

		$id = EDateianhang::findOne(['id' => $model->id_e_dateianhang])->id_person;

		$session = new Session();

		$session->addFlash("warning", "Die angeforderte Datei befindet sich nicht(mehr)auf Ihrem Server");

		return $this->redirect(['index', 'id' => $id]);

	}

//gib das Dokument im Browser aus

return Yii::$app->response->sendFile("$folder_read/$filename");

    }



If I try to get content of file,which is at NAS-server,like this…




public function actionFile($filename, $id) {

.

.

//gib das Dokument im Browser aus

return Yii::$app->response->sendFile("\\192.168.1.10\Samba_Freigabe\Datensicherungen\pics\man_0.jpg");

}



…I will get error like this,of course:




PHP Warning – yii\base\ErrorException

fopen(\192.168.1.10\Samba_Freigabe\Datensicherungen\pics\man_0.jpg): failed to open stream: 

No such file or directory



[size="2"]Any ideas,how to get content of files,which are not at Webserver?[/size]

You’ll most likely need a library like https://github.com/icewind1991/SMB to access the samba share.

And what about, if file is in another server, which is not in my network?

Is it possible,at all, to get content of file(s) in another infrastructure,which is independent of my webserver