Jonny B'Good
Jonny B'Good

Reputation: 123

php get image from url and save

I understand there are many questions asking how to do this however none seem to cover what I am after.

See url: https://nz.tradevine.com/BlobStorage/GetFullPhoto?photoID=3591090673176038018&organisationID=3468490059683634443

How can I download this image and save as plug.jpg?

I think this might be different than others because it doesn't have for example .jpg at the end of the url? either way I can't get it to download.

Upvotes: 2

Views: 4698

Answers (1)

Ashok Chandrapal
Ashok Chandrapal

Reputation: 1020

You can also do it with below code

<?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);

?>

Hope this will help!

Upvotes: 3

Related Questions