Answer the question
In order to leave comments, you need to log in
Why is the php copy image not saved?
$url = "http://img1.goodfon.ru/original/1920x1200/3/26/zmeya-udav-kolca.jpg";
copy($url,'tmpimg.jpg');
file_put_contents('tmpimg.jpg',$url);
Answer the question
In order to leave comments, you need to log in
file_put_contents as the second argument does not require the URL/PATH of the file, but the content. Those. it would be right
file_put_contents('tmpimg.jpg', file_get_contents($url));
Because you first copy this picture, and then overwrite this file with the file_put_contents command, writing the picture url inside. Remove file_put_contents altogether, it's not needed here.
Well, it would not hurt to turn on error output: phpfaq.ru/debug
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question