Using Alternative Data Formats(JSON, etc.)

The default data format for Amfphp is AMF. However Amfphp looks at the content type header to see if the request should be handled differently. For example if no content type is detected, the service browser plugin assumes that the request is coming from a Web browser and handles the request instead. There are 2 ways to inform Amfphp about the content type:

  • using the Content-Type HTTP header. See the section « 14.17 Content-Type » in for details. Sometimes this fails because of server or client configuration and limitations, which is why there is the alternative below.
  • passing the content type in the URL. For example http://youserver/Amfphp/?contentType=application/json will cause the JSON plugin to handle the request.

Try whatever method works best for you. The examples use the second method as it is easier to read.

See the distributed plugins list and third party plugins exchange to see what data formats are supported. At the time of writing, JSON and JSONP are supported.

Laissez un commentaire

Événements à venir / Upcoming Events

  1. Atelier Back To Basics HTML5

    16 février @ 19:00 - 21:00
  2. Atelier Blender : Retouche photos et insertion d’un rendu 3D

    24 février @ 19:00 - 21:00
  3. Apéropensource #32 au Super Coin

    25 février @ 19:00 - 23:00

Abonnez-vous à la newsletter

Silex Labs community Tweets

Facebook page

Abonnez-vous aux news via Email

Rejoignez 18 autres abonnés