0

i was trying to copy some images from url and when i encode that url directly in php copy function it copies without any issue but when i get that as

image url https://dl.iteens.ir/wp-content/uploads/2017/12/wedding-cake-topper-many-layers-wedding-dress-clay-by-asiaworld-120-242x300.jpg

   $decoded = json_decode($content, true);
   $urls = $decoded['url']; 

and pass $urls in copy it does not work.

  copy($urls,'path/img.jpg');

I have tested the same with

  $myfile = fopen("/something/newfile.txt", "w") 
   fwrite($myfile, $urls);
  fclose($myfile);

i can see exact same url written in newfile.txt

but this work

  copy('https://dl.iteens.ir/wp-content/uploads/2017/12/wedding-cake-topper-many-layers-wedding-dress-clay-by-asiaworld-120-242x300.jpg','path/img.jpg');

i tried different combination of copy like

copy("$urls","path/img.jpg");

nothing worked for most of the images the copy($urls,'path/img.jpg'); works but not for this link. i dont think its ip block from either server because when we give direct link it works i further tried by adding fgets($myfile); and tried to copy same thing from text file and it worked so dont know what is the problem

swetlana
  • 37
  • 6

0 Answers0