<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hey all,<div><br></div><div>I've developed a REST API using the Services module, and am in the process of writing client code examples. For API clients within a Drupal environment, the routine drupal_http_request() is a real gift. Something as simple as this:</div><div><br></div><div>$response = drupal_http_request($url, $headers, 'GET');</div><div>$data = json_decode($response-&gt;data);</div><div><br></div><div>gives clients my API responses in an easy to use array, with field names and embedded objects intact.&nbsp;</div><div><br></div><div>For clients outside of a Drupal environment I am learning to use the libcurl php extension so I can provide them with a working example of how to talk to the API. However, I'm not finding any easy way to get the API responses from cURL into an easy to use structure, such as an array. The responses from cURL seem to always be a string, even when I request binary, and not an easy string to parse from looking at it. Maybe it's in some format I'm not familiar... it looks like there's some structure to it, but not clearly obvious, like JSON.&nbsp;</div><div><br></div><div>What solutions in this arena are people using? With the popularity of APIs now, is everyone on this list using&nbsp;drupal_http_request() and not having to deal with cURL response parsing?&nbsp;</div><div><div>
<span class="Apple-style-span" style="font-family: Helvetica; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div><br class="Apple-interchange-newline">Sincerely,</div><div>-Blake</div><div><a href="mailto:bsenftner@earthlink.net">bsenftner@earthlink.net</a></div><div><a href="http://www.BlakeSenftner.com">www.BlakeSenftner.com</a></div></span></span></div></span>
</div>
<br></div></body></html>