How to get data object in php?

2

I'm passing an angle object to php, but php insisted and "telling" that the data that is coming is not an object, what should I do? How can I get this data in php?

Follow my codes

angular:

angular.module('app.controllers', [])

.controller('logradouroCtrl', function ($scope, $http, $window) {
var pegaMsgsLogra = function () {
    idCep = $window.localStorage.getItem('idCep');
    idUsuario = $window.localStorage.getItem('idUsuario');
    var dados = {
        idUsuario: $window.localStorage.getItem('idUsuario'),
        idCep: $window.localStorage.getItem('idCep')
    }
    console.log(dados);
    $http.get("http://localhost:8888/sistemas/sistemas_web/ionic/vcApp/www/php/pegaMsgsLogra.php", dados).success(function (data){
        console.log(data);
    });
}

pegaMsgsLogra();

php:

<?php
ini_set('display_errors', true);
error_reporting(E_ALL);

header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST, OPTIONS');
header('Access-Control-Allow-Headers: Content-Type,X-Prototype-Version,X-Requested-With');

include_once("conPDO.php");

$pdo = conectar();

$data = file_get_contents("php://input");
$data = json_decode($data);
print_r($data);
$idUsuario = $data->idUsuario;
$idCep = $data->idCep;

echo 'id usuario '.$idUsuario.' id cep '.$idCep;
?>

I put the console.log (date) and print_r (date) to see what's going on in php Here is the image:

    
asked by anonymous 29.01.2016 / 19:04

1 answer

4

Change $http.get to $http.post

$ http.get does not allow you to pass one dataset per parameter.

$ http.get

$ http.post allows you to pass one dataset per parameter

$ http.post

    
29.01.2016 / 19:25