- $_POST contains URL encoded (application/www-url-encoded) variables that are posted to your script and PHP decodes them for you. You use this one when you deal with HTML FORM data.
- file_get_contents("php://input") - gets the raw POST data and you need to use this when you write APIs and need XML/JSON/... input that cannot be decoded to $_POST by PHP.
- $HTTP_RAW_POST_DATA - in theory it is the same as the above but depends on php.ini.
I always use method #2 instead of #3 when I need non application/www-url-encoded input.
No hay comentarios:
Publicar un comentario