You are here

function biblio_import_from_url in Bibliography Module 7

Same name and namespace in other branches
  1. 6.2 includes/biblio.import.export.inc \biblio_import_from_url()
  2. 6 biblio.import.export.inc \biblio_import_from_url()
  3. 7.2 includes/biblio.import.export.inc \biblio_import_from_url()

File

includes/biblio.import.export.inc, line 432
Functions that are used to import and export biblio data.

Code

function biblio_import_from_url($URL) {

  // Fetch data from URL in read mode.
  $handle = fopen($URL, "r");
  $data = "";
  if ($handle) {
    while (!feof($handle)) {

      // Read data in chunks.
      $data .= fread($handle, 4096);
    }
    fclose($handle);
  }
  else {

    // Network error.
    $errorMessage = t("Error occurred: Failed to open %url", array(
      '%url',
      $URL,
    ));
    drupal_set_message($errorMessage, 'error');
  }
  return $data;
}