--- ewt.install	1970-01-01 10:00:00.000000000 +1000
+++ ewt.install	2010-06-01 13:31:36.640728464 +1000
@@ -0,0 +1,42 @@
+<?php
+
+/**
+ * Implementation of hook_requirements()
+ *
+ * Check that curl functions exist or refuse to install. This stops
+ * users without php-curl seeing a WSOD.
+ */
+function ewt_requirements($phase) {
+  $requirements = array();
+  $t = get_t();
+  if ($phase == 'install') {
+    if (!function_exists('curl_init')) {
+      $requirements['curl_init'] = array(
+        'title' => $t('cURL Library'),
+        'value' => $t('Not installed'),
+        'description' => $t('cURL is a library that is required by Ewt.'),
+        'severity' => REQUIREMENT_ERROR,
+      );
+    }
+  }
+
+  else if ($phase == 'runtime') {
+    if (!function_exists('curl_init')) {
+      $requirements['curl_init'] = array(
+        'title' => $t('cURL Library'),
+        'value' => $t('Not installed'),
+        'description' => $t('cURL is a library that is required by Ewt.'),
+        'severity' => REQUIREMENT_ERROR,
+      );
+    }
+    else {
+      $curl_version = curl_version();
+      $requirements['curl_init'] = array(
+        'title' => $t('cURL Library'),
+        'value' => $t('PHP cURL Library !version', array('!version' => $curl_version['version'])),
+        'severity' => REQUIREMENT_OK,
+      );
+    }
+  }
+  return $requirements;
+}
--- ewt-oold/ewt.module	2010-05-12 21:19:30.000000000 +1000
+++ ewt/ewt.module	2010-06-01 13:55:39.361607456 +1000
@@ -385,9 +385,15 @@
 }
 
 function ewt_client() {
-  return new EWTClient(ewt_setting('api_url'), 
+  if (function_exists('curl_init')) {
+    return new EWTClient(ewt_setting('api_url'), 
 		       ewt_setting('api_username'),
 		       ewt_setting('api_password'));
+  }
+  else {
+    drupal_set_message(t('A required PHP library is missing. Check the !status_report.', array('!status_report', l('status report', 'admin/reports/status'))), 'error');
+    return t('An error has occurred.');
+  }
 }
 
 function ewt_login_user($name, $email = '') {
