function rec_transfer_download_results in Recommender API 7.5
Same name and namespace in other branches
- 6.3 rec_transfer/rec_transfer.module \rec_transfer_download_results()
- 7.4 rec_transfer/rec_transfer.module \rec_transfer_download_results()
1 call to rec_transfer_download_results()
- rec_transfer_import_results in rec_transfer/
rec_transfer.module
File
- rec_transfer/
rec_transfer.module, line 338 - This is the module file for Recommender Data Transfer
Code
function rec_transfer_download_results($download_file, $save_file) {
$fp = fopen($save_file, 'w');
$ch = curl_init();
curl_setopt($ch, CURLOPT_USERAGENT, "Drupal (Recommender)");
curl_setopt($ch, CURLOPT_ENCODING, "gzip");
curl_setopt($ch, CURLOPT_URL, variable_get('rec_transfer_endpoint') . "/download/{$download_file}");
curl_setopt($ch, CURLOPT_FILE, $fp);
$response = curl_exec($ch);
$download_success = $response && curl_getinfo($ch, CURLINFO_HTTP_CODE) == 200;
curl_close($ch);
fclose($fp);
return $download_success;
}