I have a PHP script running on a web server. There I extract all image links from another website. This works fine.
But I have troubles to save the images to my web server. I have tried everything, for example saving the images with FTP (ftp_put), copy($source, $destination) and so on.
- Everything works fine if the image URL looks like: HTTPS://a-website.com/image.jpg
- But it does'n work with these image URLs: HTTP://another-website.com/image.jpg
Edit: some code:
$url_1 = "https://a-website.com/image.jpg";
$url_2 = "http://another-website.com/image.jpg";
copy($url_1, "image_1.jpg"); // This works
copy($url_2, "image_2.jpg"); // This doesn't work. No error or warning, but the file isn't stored.
// Both of these lines work. Both images will be displayed.
echo "<img src=\"".$url_1."\" >";
echo "<img src=\"".$url_2."\" >";
What is the reason, that HTTP-URLs can't be processed? Is this a restriction of my webhost? My php script runs on a webspace without HTTPS.