diff --git a/antispam.module b/antispam.module
index 1a9a2a1..de93dd6 100644
--- a/antispam.module
+++ b/antispam.module
@@ -2506,6 +2506,7 @@ function _antispam_api_prepare_request_data() {
  */
 function _antispam_api_build_query_string($array) {
   global $base_url;
+  $string = '';
 
   // Defensio.
   if (antispam_get_service_provider() == DEFENSIO_SERVICE) {
@@ -2536,28 +2537,30 @@ function _antispam_api_build_query_string($array) {
  *   The path where to perform the request.
  *
  * @return array
- *   Headers in $response[0] and entity in $response[1].
+ *   Object returned by drupal_http_request in $return[0] and entity in $return[1].
  */
 function _antispam_api_http_post($request, $host, $path) {
   $fsock_timeout = (int)variable_get('antispam_connection_timeout', 10);
 
-  $http_request = "POST $path HTTP/1.0\r\n"
-    . "Host: $host\r\n"
-    . "Content-Type: application/x-www-form-urlencoded; charset=utf-8\r\n"
-    . 'Content-Length: ' . strlen($request) . "\r\n"
-    . 'User-Agent: ' . ANTISPAM_API_USERAGENT . "\r\n"
-    . "\r\n"
-    . $request;
-
-  $response = '';
-  if (false !== ($fs = @fsockopen($host, ANTISPAM_API_PORT, $errno, $errstr, $fsock_timeout))) {
-    fwrite($fs, $http_request);
-    while (!feof($fs)) {
-      // One TCP-IP packet.
-      $response .= fgets($fs, 1160);
-    }
-    fclose($fs);
-    $response = explode("\r\n\r\n", $response, 2);
-  }
-  return $response;
+  $url = 'http://' . $host . ':' . ANTISPAM_API_PORT . $path;
+  $options = array();
+  $options['method'] = 'POST';
+  $options['headers']['Host'] = $host;
+  $options['headers']['Content-Type'] = 'application/x-www-form-urlencoded; charset=utf-8';
+  $options['headers']['Content-Length'] = strlen($request);
+  $options['headers']['User-Agent'] = ANTISPAM_API_USERAGENT;
+  $options['timeout'] = $fsock_timeout;
+  $options['data'] = $request;
+  
+  $response = drupal_http_request($url, $options);
+  $return = array();
+  
+  if ($response->code <> 0) {
+    $return = array();
+    $return[0] = $response;
+    if(isset($response->data)) {
+        $return[1] = $response->data;
+    }
+  }
+  return $return;
 }
