Drupal Commerce Paypal WPS - Connection refused I am trying to get the WPS module to work for Drupal Commerce but I am getting an error. After the payment is made in my logs I see.


  Attempt to validate IPN failed with error -111: Connection refused


The code that this relates to in the pay pal module is:

// Process the HTTP request to validate the IPN.
$response = drupal_http_request($host, array('method' =&gt; 'POST', 'data' =&gt; implode('&amp;', $variables)));

// If an error occurred during processing, log the message and exit.
if (property_exists($response, 'error')) {
  watchdog('commerce_paypal', 'Attempt to validate IPN failed with error @code: @error', array('@code' =&gt; $response-&gt;code, '@error' =&gt; $response-&gt;error), WATCHDOG_ERROR);
  return FALSE;
}


The $response has an error in it (Connection refused).

As I am using the sandbox the $host is https://www.sandbox.paypal.com/cgi-bin/webscr.

I can confirm that I do receive the IPN from PayPal (some dd() statements proved this), but when we check to see if PayPal sent it, the code falls over.

Any ideas what could be going wrong? I am preusming it is more likley to be enviromental rather than code.
This was an environmental problem. The Drupal server did not have a direct connection to the internet. Setting the proxy settings in settings.php got this to work.

http://devincarlson.ca/blog/configuring-drupal-use-proxy-server-when-making-external-http-requests

In my case the settings I had to set were:

$conf['proxy_server'] = 'my server';
$conf['proxy_port'] = 1234; // port number