AnsweredAssumed Answered

FM 16 cURL - get specified response header value

Question asked by fmdataweb on Apr 27, 2018
Latest reply on Apr 28, 2018 by fmpdude

I'm working with the v16 Insert from URL/cURL options and need to retrieve a specified header from the response headers. For example I get the following response headers from my web service:


HTTP/1.1 200 OK

X-Powered-By: PHP/5.6.35

Content-Type: application/json; charset=UTF-8

X-Robots-Tag: noindex

X-Content-Type-Options: nosniff

Access-Control-Allow-Headers: Authorization, Content-Type

Expires: Wed, 11 Jan 1984 05:00:00 GMT

Cache-Control: no-cache, must-revalidate, max-age=0

X-WP-Total: 3

X-WP-TotalPages: 1

Allow: GET, POST

Content-Length: 1031

Date: Fri, 27 Apr 2018 13:01:25 GMT

Server: LiteSpeed

Connection: Keep-Alive


I need to get the header "X-WP-Total: 3" - this will not necessarily appear in the same position each time so I can't simply use the GetValue function to retrieve it. With the BaseElements plugin I would use this function:


BE_HTTP_Response_Headers ("X-WP-Total")


to retrieve this header line. I'm looking for the some equivalent native function to get a single line from the response headers by specifying the header key/name. Anyone have any ideas how to do this? I'm trying to avoid having another loop in my script that loops through all the values and looks for a string that starts with "X-WP-Total" if possible.