code: protected function downloadMediaFileFromURL($fileUri, $tempFileName)
      {
          $curl = curl_init();
          curl_setopt($curl, CURLOPT_URL, "$fileUri");
          curl_setopt($curl, CURLOPT_USERAGENT,
              "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11");
          curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
          curl_setopt($curl, CURLOPT_HEADER, false);
          curl_setopt($curl, CURLOPT_NOBODY, false);
          curl_setopt($curl, CURLOPT_BUFFERSIZE, 1024);
          curl_setopt($curl, CURLOPT_FILE, $tempFileName);
          curl_exec($curl);
          curl_close($curl);
      }
docs: Download the file from the URL provided.
  
  @param string $fileUri
  @param string $tempFileName