--- stockapi.module.orig	2008-05-20 12:34:22.000000000 -0400
+++ stockapi.module	2008-05-30 19:16:44.000000000 -0400
@@ -107,8 +107,20 @@
     watchdog('stockapi', t('StockAPI: drupal_http_request code: @code', array('@code' => $result->code)));
     return FALSE;
   }
+  
+  // Save the CSV data to a temporary file
+  $dir = variable_get('file_directory_temp', '/tmp');
+  $file = $dir . '/quote.' . $symbol . '.csv';
+  $file = file_save_data($result->data, $file, FILE_EXISTS_REPLACE);
+  
+  // Load the CSV data into the $data array
+  $fp = fopen($file, 'r');
+  $data = fgetcsv($fp);
+  fclose($fp);
+
+  // Delete the temp file
+  file_delete($file);
 
-  $data = explode(',', str_replace('"', '', $result->data));
   if (!$data) {
     watchdog('stockapi', t('StockAPI: no data for symbol(s): @symbol', array('@symbol' => $symbol)));
     return FALSE;
