Is there anyway we can download the user profile photos in moodle using script?

Is there anyway we can download the user profile photos in moodle using script?

by Ahsan Gul -
Number of replies: 0

I am currently working on task where I have to download user profile photos from moodle in a certain group. I get the urls of the photos by using: $source = moodle_url::make_pluginfile_url($context->id, 'user', 'icon', null, '/', 'f3'); but when I use file_put_contents($destination, file_get_contents($source)) where $distincation is a proper path in moodledata temp folder. But it doesn't copy the photo. I also used copy($source , $distincation) still no luck. Any help will be appreciated. Thanks.

Average of ratings: -