Skip to content

Instantly share code, notes, and snippets.

@klaasvw
Last active December 6, 2020 08:28
Show Gist options
  • Save klaasvw/b580cb53cc46ebc76ab3a1e2104869df to your computer and use it in GitHub Desktop.
Save klaasvw/b580cb53cc46ebc76ab3a1e2104869df to your computer and use it in GitHub Desktop.
Download file in Drupal using Guzzle
<?php
$external_file = 'https://www.example.com/test.png'
$destination = 'public://file.png';
$response = \Drupal::httpClient()->get($external_file, ['sink' => $destination]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment