Home > PHP > Function > HTTP > http_negotiate_content_type()

http_negotiate_content_type()

http_negotiate_content_type - Negotiate clients preferred content type

Syntax

string http_negotiate_content_type (array $supported, array &$result)

Arguments

  • supported - array containing the supported content types as values
  • result - will be filled with an array containing the negotiation results

Description

This function negotiates the clients preferred content type based on its AcceptHTTP header. The qualifier is recognized and content types without qualifier are rated highest.

Version

PHP PECL pecl_http >= 0.19.0

Return value

Returns the negotiated content type or the default content type (i.e. first array entry) if none match.