php - How to download file to my server (Yii framework) from another server? -


i need webapp create file on server server. input parameter url of remote file. stumbled upon curl wrapper yii. right tool task?

i found solution. no need of third-party modules. here draft version:

<?php $f1 = fopen($_request['pic_url'],'r'); $fcontent = $contents = stream_get_contents($f1); fclose($f1);  $filename = microtime().'.'.cfilehelper::getextension($_request['pic_url']);  $f2 = fopen(yii::app()->basepath.'/../images/'.$filename,'c+'); fwrite($f2,$fcontent,strlen($fcontent)); fclose($f2); ?> 

basically code reads image on remote server , saves on home server.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

How to get multiresult with multicondition in Sql Server -