FamilySearch / fs-php-lite

Lite PHP SDK for the FamilySearch API
Apache License 2.0
3 stars 4 forks source link

Update response parsing to match new format #9

Closed andrewatwood closed 3 years ago

andrewatwood commented 3 years ago

A few changes to the FamilySearch server configuration broke the previous parsing:

  1. HTTP version changed to 2 from 1.x
  2. No more HTTP status text ('OK' or 'Timeout')
  3. Header names are now all lowercase

statusText is never used internally, and since the string no longer exists in the response, I switched to using curl_getinfo to natively get the statusCode and removed references to statusText. This allows a much simpler, regex-free parsing of the headers and response body, which is now done by splitting on the empty line (\r\n\r\n).