php - download image from another server url without saving in my server folder -


i have problem in download image url,

$url = 'http://example.com/image.php'; $img = '/my/folder/flower.gif'; file_put_contents($img, file_get_contents($url)); 

in code file saving in server folder .but needed without saving in server needs download user.

set correct header , echo out instead of file_put_contents

$url = 'http://example.com/image.php';  header('content-disposition: attachment; filename:image.jpg'); echo file_get_contents($url); 

Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

c++ - End of file on pipe magic during open -