我试图通过以下代码从Slack通道下载图像,但我只是得到页面的html代码.
我是在做傻事,还是有诀窍让这很难?
copy('https://i-blog.csdnimg.cn/blog_migrate/827617a5ebe87566462ca1945e6c732e.png', 'file.jpeg');
echo '';
echo '
';
//Get the file
$content = file_get_contents("https://i-blog.csdnimg.cn/blog_migrate/827617a5ebe87566462ca1945e6c732e.png");
//Store in the filesystem.
$fp = fopen("image.jpg", "w");
fwrite($fp, $content);
fclose($fp);
echo '';
echo '
';
$url_to_image
= 'https://i-blog.csdnimg.cn/blog_migrate/827617a5ebe87566462ca1945e6c732e.png';
$ch = curl_init($url_to_image);
$my_save_dir = 'images/';
$filename = basename($url_to_image);
$complete_save_loc = $my_save_dir . $filename;
$fp = fopen($complete_save_loc, 'wb');
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_exec($ch);
curl_close($ch);
fclose($fp);
echo '';
echo '
';
echo '
![image003_480.jpg](https://i-blog.csdnimg.cn/blog_migrate/827617a5ebe87566462ca1945e6c732e.png)
echo '
![image003_360.jpg](https://i-blog.csdnimg.cn/blog_migrate/35a42a53392c46be0ad9134e4f86ccc3.png)
echo '
![image003.jpg](https://i-blog.csdnimg.cn/blog_migrate/3b522b5d67b855e33fef10f3721fccf9.png)
?>
wget也被愚弄了;
wget -nd -r -P /myLocalPath/images -A jpeg,jpg,bmp,gif,png https://i-blog.csdnimg.cn/blog_migrate/827617a5ebe87566462ca1945e6c732e.png