Skip to content
Advertisement

Flask API is unable to receive data from PHP

I’m trying to run a flask API in a specific port number as below,

JavaScript

And trying to send data using PHP

JavaScript

But every time API is receiving null The response body is something like

JavaScript

Advertisement

Answer

Flask needs to know that it is receiving “json”. In your PHP script you need to add additional “Content-Type” header.

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement