title: Flask API is unable to receive data from PHP
body: <p>I'm trying to run a flask API in a specific port number as below,</p>
  
  <pre><code>from flask import Flask, request
  from pymongo import MongoClient
  import json
  
  
  app = Flask(__name__)
  
  @app.route("/")
  def hello():
      return "Befriend Registration"
  @app.route("/reg", methods=["POST"])
  def pushDB():
      somedata= request.get_json()
      return json.dumps({"status":"OK", "Data": somedata})
  
  if __name__ == '__main__':
      app.run(port= 34000, debug=True)
  </code></pre>
  
  <p>And trying to send data using PHP</p>
  
  <pre><code>&lt;?php
      $url = 'http://127.0.0.1:34000/reg';
      $data = array("collection" =&gt; "RapidAPI");
      $curl = curl_init($url);
      curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($curl, CURLOPT_POST, true);
      curl_setopt($curl, CURLOPT_POSTFIELDS,  json_encode($data));
      $response = curl_exec($curl);
      echo $response;
      curl_close($curl);
  ?&gt;
  </code></pre>
  
  <p>But every time API is receiving <code>null</code> 
  The response body is something like</p>
  
  <pre><code>{
  status: "OK",
  Data: null
  }
  </code></pre>