How to get a json link and use it in php

1

I get the following json link:

http://localhost/json/?conteudo={"Login":"[email protected]","Senha":"12345","Posicao":{"Latitude":"-18.8693459","Longitude":"-41.955664"}}

How to play it for the php below:

<?php 


$valor = json_decode('LINK AQUI');                      

echo "<pre>";                       
print_r($valor);                        

?>
    
asked by anonymous 06.01.2017 / 04:26

1 answer

1

The JSON structure is being passed by querystring , so you need to use the $ _GET variable to get it.

Example:

<?php 


$valor = json_decode($_GET['conteudo']);                      

echo "<pre>";                       
print_r($valor);                        

?>
    
06.01.2017 / 04:32