How to take a json link and use it in php

Asked

Viewed 117 times

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 php below:

<?php 


$valor = json_decode('LINK AQUI');                      

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

?>

1 answer

1


The structure JSON is being passed by querystring, then you need to use the variable $_GET to catch her.

Example:

<?php 


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

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

?>
  • exactly that, thank you!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.