original_string: public static function download_course_backup($hubcourseid, $path) {
          $fp = fopen($path, 'w');
  
          $curlurl = new \moodle_url(HUB_MOODLEORGHUBURL . '/local/hub/webservice/download.php',
              ['filetype' => self::HUB_BACKUP_FILE_TYPE, 'courseid' => $hubcourseid]);
  
          // Send an identification token if the site is registered.
          if ($token = registration::get_token()) {
              $curlurl->param('token', $token);
          }
  
          $ch = curl_init($curlurl->out(false));
          curl_setopt($ch, CURLOPT_FILE, $fp);
          curl_exec($ch);
          curl_close($ch);
          fclose($fp);
      }
code: public static function download_course_backup($hubcourseid, $path) {
          $fp = fopen($path, 'w');
  
          $curlurl = new \moodle_url(HUB_MOODLEORGHUBURL . '/local/hub/webservice/download.php',
              ['filetype' => self::HUB_BACKUP_FILE_TYPE, 'courseid' => $hubcourseid]);
  
          // Send an identification token if the site is registered.
          if ($token = registration::get_token()) {
              $curlurl->param('token', $token);
          }
  
          $ch = curl_init($curlurl->out(false));
          curl_setopt($ch, CURLOPT_FILE, $fp);
          curl_exec($ch);
          curl_close($ch);
          fclose($fp);
      }
code_tokens: public static function download_course_backup ( $ hubcourseid , $ path ) { $ fp = fopen ( $ path , 'w' ) ; $ curlurl = new \ moodle_url ( HUB_MOODLEORGHUBURL . '/local/hub/webservice/download.php' , [ 'filetype' => self :: HUB_BACKUP_FILE_TYPE , 'courseid' => $ hubcourseid ] ) ; // Send an identification token if the site is registered. if ( $ token = registration :: get_token ( ) ) { $ curlurl -> param ( 'token' , $ token ) ; } $ ch = curl_init ( $ curlurl -> out ( false ) ) ; curl_setopt ( $ ch , CURLOPT_FILE , $ fp ) ; curl_exec ( $ ch ) ; curl_close ( $ ch ) ; fclose ( $ fp ) ; }
docstring: Downloads course backup
  
  @param int $hubcourseid id of the course on moodle.net
  @param string $path local path (in tempdir) to save the downloaded backup to.
docstring_tokens: Downloads course backup