【问题标题】:php get image from url and savephp从url获取图片并保存
【发布时间】:2016-11-05 11:47:20
【问题描述】:

我知道有很多问题询问如何做到这一点,但似乎没有一个涵盖我所追求的。

查看网址:https://nz.tradevine.com/BlobStorage/GetFullPhoto?photoID=3591090673176038018&organisationID=3468490059683634443

如何下​​载此图片并保存为 plug.jpg?

我认为这可能与其他的不同,因为它在 URL 的末尾没有例如 .jpg?无论哪种方式,我都无法下载它。

【问题讨论】:

标签: php image curl download


【解决方案1】:

你也可以用下面的代码来做

<?php

$file = file_get_contents('https://nz.tradevine.com/BlobStorage/GetFullPhoto?photoID=3591090673176038018&organisationID=3468490059683634443');

$myfile = fopen("plug.jpg", "w") or die("Unable to open file!");
fwrite($myfile, $file);
fclose($myfile);

?>

希望这会有所帮助!

【讨论】:

    猜你喜欢
    • 2016-10-04
    • 2020-03-09
    • 1970-01-01
    • 2012-12-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-03-22
    • 2010-10-17
    相关资源
    最近更新 更多