not receiving data in php


Why I am not receiving data in php

let body     : string   = "key=insert&name=" + + "&email=" + + "&contact=" + this.number,
         type: 'application/x-www-form-urlencoded',
          headers  : any      = new Headers({ 'Content-Type': type}),
          options  : any      = new RequestOptions({ headers: headers }),
          url      : any      = "";
        .subscribe((data) => {

in php


error -> undefined $_REQUEST[‘name’]


I am not very familiar with the HTTP module yet, but I see that you are declaring the body as a string, is this the proper way to do it? As you are getting an error about the name variable, I guess the body ain’t getting created properly for some reason. May be you can make the body an object and then while calling the post method JSON.stringify() it?


Done that way also still same


Hm okay, would like to see that code. This might help too:


You are using multiple variable declaration syntax, I am not sure if that’s allowed in typescript. It might be causing the problems? You should probably try to either create a single object and use it’s properties wherever needed or create each of the variables individually.


Thank you for posting for the same problem multiple times in different stages, I wasted my time responding to your other topics.

Does your code actually call the URL successfully?


Yes it’s calling but the problem is there when I am accessing the key it’s showing invalid key name and if check in headers body is going in json format