We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

post with this header application/x-www-form-urlencoded

How can I send a post with header application/x-www-form-urlencoded with phalcon ? Please someone help me



17.5k

Can you just use the header() method in PHP?

edited Sep '16

I guess you don't need Content-Type header only, but entire POST data with fields which are URL encoded etc. You need to either use RAW PHP or curl (preferred).

So, that's if your app plays role of a client (i.e. you are sending data to an external API). On the contrary, if your app is both a client and a server (regular web app), all you need to do is to build HTML form with POST method, which will set Content-Type: application/x-www-form-urlencoded.

These are very foundations of the HTTP protocol.

@zhegwood header() in PHP is not a method but function. It's the same as using setHeader() method in Phalcon's Response component, which is always more favoured solution (i.e. if you use a framework, use it on each stack level).