hi Ionics,
i have some difficulties to parse the $http.post() data via php.
this is my angularjs part :
var postUrl = ‘http://my_url’;
var data = {“lat”: location.latitude, “lng”: location.longitude, “user_id”: 3};
var config = {
headers : {‘Content-Type’:‘application/x-www-form-urlencoded; charset=UTF-8’},
cache: false
};
$http.post(postUrl, data, config)
.success(function (data, status, headers, config)
$scope.status = status;
$scope.data = data;
}).error(function (err) {
$scope.data = "Request failed";
$scope.status = status;
});
my php (parser) code ;
//file_get_contents only works when allow_url_fopen
ini_set("allow_url_fopen", true);
$data = file_get_contents("php://input");
$postData = json_decode($data);
thanks for help