I am writing an app in which i am allowing user to enter their product details into a framework [i have made on PHP] and then by using that framework i am encoding data into json and that encoded data i am retrieving in my Android App using web services.
But now issue is i am not able to encode web image url therefore i am not getting correct image path in json:-
Like:
I have given this link to encode into JSON:
"imageurl" => "http://www.libpng.org/pub/png/img_png/pnglogo-blk-sml1.png"
but whenever i see encoded web image url in JSON getting something like this:
"imagepath":"http:\/\/www.libpng.org\/pub\/png\/img_png\/pnglogo-blk-sml1.png"
why i am getting wrong image url....
I don't know how can i resolve this issue..please someone help me....
albums.php:
<?php
/*
*Simple JSON generation from static array
*Author: JSR
*/
include_once './data.php';
$albums = array();
// looping through each album
foreach ($album_tracks as $album) {
$tmp = array();
$tmp["id"] = $album["id"];
$tmp["name"] = $album["album"];
$tmp["description"] = $album["detail"];
$tmp["imagepath"] = $album["imageurl"];
$tmp["songs_count"] = count($album["songs"]);
// push album
array_push($albums, $tmp);
}
//printing json
echo json_encode($albums);
?>
data.php:
<?php
/*
*Simple JSON generation from static array
*Author: JSR
*/
$album_tracks = array(
1 => array(
"id" => 1,
"album" => "Appetizers",
"detail" => "All appetizers served with mint and tamarind chutneys.",
"imageurl" => "http://www.libpng.org/pub/png/img_png/pnglogo-blk-sml1.png"
)
));
?>