Thursday, October 11, 2012

Drupal REST process update

I posted earlier about the problems I have had integrating Drupal 7 REST with an external site.  Since my last post on the topic,  it has been working flawlessly.

Today, though, I upgraded the Drupal site to use Services 7.x-3.2, and configured the site to require TLS for all traffic.

The REST connection died with no explanation.

After an hour of stressful debugging, I found two separate causes:

1. The upgrade of the Services module reset the REST resources settings. I had to re-enable parsing of application/x-www-form-urlencoded  and the node resource. http://stackoverflow.com/questions/8535820/drupal-login-via-rest-server

2. Requiring all traffic to route through https (TLS) killed the PHP cURL methods.  For a debugging quick fix, adding curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); solved the problem. For a better solution, see http://unitstep.net/blog/2009/05/05/using-curl-in-php-to-access-https-ssltls-protected-sites/

No comments:

Post a Comment