viernes, 23 de septiembre de 2016

json decode

response received from the remote host

{"location_original":null,"location_original_id":null,"location_1":"Franklin","location_1_id":"4","location_2":"Hart Lane","location_2_id":"7","location_3":"Hickory Hollow","location_3_id":"6","resp_code":0}


code to insert json values into an array
<?php
$url=file_get_contents("http://50.30.63.85:8012/sms_two_way/api/getBranchesByZipCode.php?zip_code=37067");

$url=json_decode($url, true);

foreach($url as $key=>$value){

echo " $key : $value<br>";

}
?>

PHP OUPUT

location_original :
location_original_id :
location_1 : Franklin
location_1_id : 4
location_2 : Hart Lane
location_2_id : 7
location_3 : Hickory Hollow
location_3_id : 6
resp_code : 0

No hay comentarios:

Publicar un comentario