Extract Image url from WordPress REST API JSON response - json

I'm new to WordPress REST API and I don't know how to extract the image URLs from the "content" key of the API (https://www.example.com/wp-json/wp/v2/posts) response which looks like this:
"content": {
"rendered": "\n<p>From munching on a casual pizza to romantic candlelit dinner in Kolkata with your better half, Valentine’s week is filled with all of these!</p>\n\n\n\n<p>The love week of February offers the perfect excuse to sample Kolkata’s very best restaurants with your other half.</p>\n\n\n\n<p>Find your dream date night in our Valentine’s Day special guide to the cutest restaurants in Kolkata.</p>\n\n\n\n<h2><i><center>Blue and Beyond</center></i></h2>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img src=\"https://kolkatasutra.com/wp-content/uploads/2021/02/blue-n-beyond.png\" alt=\"\" class=\"wp-image-919\" srcset=\"https://kolkatasutra.com/wp-content/uploads/2021/02/blue-n-beyond.png 540w, https://kolkatasutra.com/wp-content/uploads/2021/02/blue-n-beyond-300x197.png 300w, https://kolkatasutra.com/wp-content/uploads/2021/02/blue-n-beyond-150x99.png 150w\" sizes=\"(max-width: 540px) 100vw, 540px\" /><figcaption>Blue & Beyond, New Market</figcaption></figure></div>\n\n\n\n<p>Situated in the New Market area, this place boasts of beautiful rooftop open-air seating. It also has an indoor seating</p>\n\n\n\n<p>You can expect a feel of colonial Kolkata with Stuart Hogg Market below."
}
I tried this solution, but the "featured_media" is 0 in my case.
Installed this plugin, but the field "better_featured_image" is showing as null in all the posts.
This is the only solution that might solve the problem, but I don't know how to extract Image URLs using Regex.
Please help me with the Regex to extract the URLs. Or if there's another way which might help, please mention in the ans.

You can decode json string usgin json_decode() fucntion. then you can preg_match to match with '/src="([^"]*)"/' regex that extract your src. check below code.
<?php
$image = '{"content": {"rendered": "\n<p>From munching on a casual pizza to romantic candlelit dinner in Kolkata with your better half, Valentine’s week is filled with all of these!</p>\n\n\n\n<p>The love week of February offers the perfect excuse to sample Kolkata’s very best restaurants with your other half.</p>\n\n\n\n<p>Find your dream date night in our Valentine’s Day special guide to the cutest restaurants in Kolkata.</p>\n\n\n\n<h2><i><center>Blue and Beyond</center></i></h2>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img src=\"https://kolkatasutra.com/wp-content/uploads/2021/02/blue-n-beyond.png\" alt=\"\" class=\"wp-image-919\" srcset=\"https://kolkatasutra.com/wp-content/uploads/2021/02/blue-n-beyond.png 540w, https://kolkatasutra.com/wp-content/uploads/2021/02/blue-n-beyond-300x197.png 300w, https://kolkatasutra.com/wp-content/uploads/2021/02/blue-n-beyond-150x99.png 150w\" sizes=\"(max-width: 540px) 100vw, 540px\" /><figcaption>Blue & Beyond, New Market</figcaption></figure></div>\n\n\n\n<p>Situated in the New Market area, this place boasts of beautiful rooftop open-air seating. It also has an indoor seating</p>\n\n\n\n<p>You can expect a feel of colonial Kolkata with Stuart Hogg Market below."}}';
$image = json_decode($image, true);
preg_match('/src="([^"]*)"/',$image['content']['rendered'], $result);
echo $result[1]; die;
?>

Related

How to add polylines to this particular Google Maps?

Can someone help me with what I need to add and where so I can make polylines between Markers for my journey on my site. Thanks in advance. I try to figure out by myself and I didn't sucseed. If anyone can tell me it would be very nice.
<!DOCTYPE>
<html>
<head>
<title></title>
<style type="text/css">
body
{
font-family: Arial;
font-size: 10pt;
}
</style>
</head>
<body>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
var markers = [
{
"title": 'Nusay Hotel, Ashgabat',
"lat": '37.9293938',
"lng": '58.3841203',
"description": 'DAY 01 - DAY 03 Arrive ASHGABAT We are cordially welcomed upon arrival at Ashgabat Airport and then transferred to our hotel. Balance of the day is free at leisure. An ex Soviet state, Turkmenistan is a one party state. Ashgabat, relatively a very small city, offers very interesting sites to see. Resource rich Turkmens have invested in beautifying their capital with a lot of marble of immense size and shapes. Ashgabat was recently noted by the Guinness Book of World Records as having the highest number of white marble-clad buildings in the world - 543 new buildings lined with white marble covering a total area of 4.5 million square meters. DAY 02 ASHGABAT Our study into the heritage of Central Asia starts as we explore the Parthian Fortresses of Nisa*. The site is of one of the earliest and most important cities of the Parthian Empire, a major power from the mid-3rd century BC to the 3rd century AD. Archaeological excavations in two parts of the site have revealed richly decorated architecture, illustrative of domestic, state and religious functions. Situated at the crossroads of important commercial and strategic axes, this powerful empire formed a barrier to Roman expansion while serving as an important communication and trading centre between east and west, north and south. We then head to theSpiritual Mosque, one of the biggest mosques in Central Asia, visit the National Museum of History and continue to Arch of Neutrality. In the afternoon we drive to GeokDepe to visit Arkadash stud farm (subject to opening) to see Akhalteke horses, the pride of Turkmen nation. Our tour concludes with visits to Presidential Square, ErtogrulGhazy Mosque, drive through some of the marble structures and the newly built Independence Park. Dinner tonight will be at the Poytagt Restaurant introducing us to food and cuisines of Central Asia. DAY 03 ASHGABAT/MARY/ASHGABAT An early morning short flight gets us to Mary to visit the State Historical and Cultural Park Ancient Merv*, which is the oldest and best-preserved of the oasis-cities along the Silk Route in Central Asia. The remains in this vast oasis span 4,000 years of human history. A number of monuments are still visible, particularly from the last two millennia, such as the Sultan Sanjar Mausoleum, the Large and Small Gyz Gala, Erk Gala, Gyaur Gala, Keshk Fortress, among others. On our way back to Mary we visit an artist’s home to see a demonstration of carpet weaving, embroidery, painting, cooking of local bread. After lunch we take our flight back to Ashgabat. Evening free.'
},
{
"title": 'JipekJoli Hotel, Nukus',
"lat": '42.465825',
"lng": '59.607718',
"description": 'DAY 04 After a short flight to Dashoguz we head to Kunya-Urgench*, situated in on the left bank of the Amu Daria River. The old town contains a series of monuments mainly from the 11th to 16th centuries, including a mosque, the gates of a caravanserai, fortresses, mausoleums and a 60-m high minaret. The monuments testify to outstanding achievements in architecture and craftsmanship whose influence reached Iran and Afghanistan, and later the architecture of the Mogul Empire of 16th-century India. After our visit of KunyaUrgench we drive to the Turkmenistan-Uzbekistan border point at Khojeyli, where we go through border formalities on both checkpoints, whilst being an interesting experience they do lack modern facilities. A short drive viewing the countryside gets us to Nukus – a place that is almost lost in the middle of the desert.'
},
{
"title": 'Grand Abdi Malik Hotel, Khiva',
"lat": '41.377115',
"lng": '60.3580361',
"description": 'DAY 05 Morning we visit the SavitskyKarakalpakstan Art Museum, which hosts the worlds second largest collection of Russian avant-garde art applied arts objects. It is also home to one of the largest collections of archeological objects and folk, applied and contemporary art originating from Central Asia. Drive through rural Uzbekistan to the historical city of Khiva. Here we explore the Ichan-Kala - the inner town (protected by brick walls some 10 m high) of the old Khiva oasis, which was the last resting-place of caravans before crossing the desert to Iran. Although few very old monuments still remain, it is a coherent and well-preserved example of the Muslim architecture of Central Asia. There are several outstanding structures such as the Djuma Mosque, the mausoleums and the madrasas and the two magnificent palaces built at the beginning of the 19th century by Alla-Kulli-Khan. Dinner at the popular Yassaulbashi restaurant.'
},
{
"title": 'Omar Khayyam Hotel, Bukhara',
"lat": '39.7703649',
"lng": '64.4149347',
"description": 'DAY 06 - DAY 07 A short drive to Urgench the capital of Khorezm province. It has a population of 150,000 inhabitants. We will have a drive through of the city before talking our flight to the historical Silk Road city of Bukhara. Upon arrival at Bukhara the most well known of the Silk Road oasis dating back to over 2,000 years. It is the most complete example of a medieval city in Central Asia, with an urban fabric that has remained largely intact. Monuments of particular interest include the famous tomb of Ismail Samani, a masterpiece of 10th-century Muslim architecture, and a large number of 17th-century madrasas. Afternoon we enjoy a walking tour of Bukhara, visiting several mosques, madrasas and the hat seller’s market. Evening we enjoy a folklore show at the Devanbegi Madrasa. End the day the Bukharan style with dinner enjoying Bukharan cuisine at the Minzifa Restaurant located in the Old Town. DAY 07 Today we continue our tour through the Historic Centre of Bukhara*, which houses over 140 architectural monuments. Bukhara had narrow streets will remind us of the Arabian Nights. After seeing the historical sites we visit Akbar’s Gallery where one can seea rich collection of old carpets and suzzane – his display center is like a museum assisted by UNESCO – his collection is well known to the Metropolitan Museum. To culminate our Bukhara experience we visit a miniaturist house where we see the workshop of the painters and his students all trying to retain the traditional art. Miniature painting was introduced here from Persia and the same tradition continued for many years but is facing its challenges with modernity. We join in for a home cooked meal.'
},
{
"title": 'Grand Samarkand Hotel, Samarkand',
"lat": '39.6725002',
"lng": '66.9364854',
"description": 'DAY 08 - DAY 09 Yet another tour of the historical city visiting the SitoraiMokhi-Khosa Palace followed by the residence of the Emir of Bukhara, the Mausoleum of the Sufi BakhoutdinNaqshbandi and the ChorBakr Necropolis. As we continue to Samarkand we stop atGijduvon to visit a famous madrassa built by Ulugh Beg the Timurid Sultan, astronomer and mathematician. We also visit the tomb and memorial of the prominent philosopher AbduholikGijduvoni, after whom the city is named. An interesting insight to the arts of Uzbekistan as we visit the famous pottery works of Alisher well known for his unique style and color. Past famous visitors include Prince Charles, Lady Diana and Hillary Clinton. Arrival Samarkand late afternoon. Evening, after some free time to stroll through the lanes of this historical city we are treated to dinner at the famous Old City Restaurant of Samarkand. DAY 09 This day is dedicated to explore the Historic town of Samarkand* - a crossroad and melting pot of the worlds cultures. Founded in the 7th century B.C. as ancient Afrasiab, Samarkand had its most significant development in the Timurid period from the 14th to the 15th centuries. The major monuments include the Registan Mosque and madrasas, Bibi-Khanum Mosque, the Shakhi-Zinda compound and the Gur-Emir ensemble, as well as Ulugh-Begs Observatory. Time permitting we visit a family home to learn how the most popular Uzbek meal, the pulao, is cooked. Evening is free and you may visit the local Afghan carpet makers, the local winery, the Kunhil paper makers or just back into time.'
},
{
"title": 'ShakreSabz Star Hotel, Shakhrisyabz',
"lat": '39.0400391',
"lng": '66.8069597',
"description": 'DAY 10 Morning we tour the Afrosiyob Museum and the tomb of Saint Daniel. Then we drive to KoniGhil village to see the traditional way of making Samarkand paper from mulberry leaves. Continue to the Historic Centre of Shakhrisyabz*, the birthplace of Tamerlane. The city contains a collection of exceptional monuments and ancient quarters that bear witness to the citys secular development, and particularly to the period of its apogee, under the rule of Amir Temur and the Temurids, in the 15th-16th century. Dinner will be a local experience at Alisher’s House. Evening free.'
},
{
"title": 'Serena Hotel, Dushanbe',
"lat": '38.5142164',
"lng": '68.7511861',
"description": 'DAY 11 - DAY 12 An early morning departure as we drive to the capital city of Tajikistan. Upon arrival at the border we first complete exit border formalities of Uzbekistan and then a short walk across to the Tajik side to do the entry border formalities. Change of vehicles as we drive to Dushanbe. We arrive at Dushanbe and are transferred to our hotel. Tajikistan is a double landlocked country, which was part of the Soviet Union and now has a Presidential form of government. It has a population of 8 million. Evening we are treated to Turkish/Tajik local cuisine dinner at the Café Merve Turkish. DAY 12 Our day in Dushanbe is spent visiting the National Museum of Tajikistan, the Gurminj Musical Instruments Museum, Statue of Ismail Samani and Rudaki Park. Subject to permit we also visit the recently built and an architectural marvel, the IsmailiJamatkhan and Centre. Lunch is at the Traktir Restaurant known for its speciality of Ukranian cuisine. We then visit the Botanical Gardens and culminate with an experience of the local bazaar. Evening is free to stroll the street and meet the friendly Tajiks at the teahouses.'
},
{
"title": 'Lotte Hotel, Tashkent',
"lat": '41.309827',
"lng": '69.2665513',
"description": 'DAY 13 We explore Uzbekistan’s capital visiting the Old City, including the Khast-Imom Complex where the world famous Quran of Caliph Uthman/Ottoman has been preserved, the Madrasah of Barak-Khan, Tilla Sheikh Mosque, the Mausoleum of the Saint Abu BakrKaffalShashi, the Islamic Institute of Imam al-Bukhari and explore Chor-Su Bazaar. An evening flight gets us to the largest and until recently the capital city of Kazakhstan. Upon arrival at Alma Aty we are welcomed and transferred to our hotel.'
},
{
"title": 'Otrar Hotel, Almaty',
"lat": '43.2608189',
"lng": '76.9495966',
"description": 'DAY 14 An early morning departure as we drive to the capital city of Tajikistan. Upon arrival at the border we first complete exit border formalities of Uzbekistan and then a short walk across to the Tajik side to do the entry border formalities. Change of vehicles as we drive to Dushanbe. We arrive at Dushanbe and are transferred to our hotel. Tajikistan is a double landlocked country, which was part of the Soviet Union and now has a Presidential form of government. It has a population of 8 million. Evening we are treated to Turkish/Tajik local cuisine dinner at the Café Merve Turkish.'
},
{
"title": 'Ak-Keme Hotel, Bishkek',
"lat": '42.8375965',
"lng": '74.5818513',
"description": 'DAY 15 We start early today on what is going to be a long day. Our tour begins with a visit to the Panfilov Park, followed by Zenkov Cathedral, St. Nicholas Cathedral and the Green Bazaar. From here we drive through Chang an-Tianshan Corridor*. We visit the Petroglyphs within the Archaeological Landscape of Tamgaly*. Set around the lush Tamgaly Gorge, amidst the vast, arid Chu-Ili Mountains, is a remarkable concentration of some 5,000 petroglyphs (rock carvings) dating from the second half of the second millennium BC to the beginning of the 20th century. Distributed among 48 complexes with associated settlements and burial grounds, they are testimonies to the husbandry, social organization and rituals of pastoral peoples. From here we drive to the border to Kyrgyzstan and continue to our hotel in Bishkek. Known alsos as Furunze, Bishkek is the capital city of Kyrgyzstan. Lunch will be at the Arzu Restaurant.'
},
{
"title": 'Four Seasons Karven Resort, IssykKul Lake',
"lat": '42.6035605',
"lng": '76.936764',
"description": 'DAY 16 - DAY 18 We enjoy our tour of Bishkek, which includes visits to Oak Park, Ala-Too Square, Statue of Manas, the Philharmonic Hall and Victory Monument. Drive to Balasagun and visit the historical Burana Tower*, which dates back to the 9th century AD. We will also visit the nearby museum. We then proceed eastwards into the mountains to Cholpon-Ata where we visit the local rock drawings of the Bronze periods, the local museum and a small local bazaar before arriving at our resort at Central Asia’s most popular will known resort. The Four Season’s Karven is known also for its impressive views of the imposing alpine ranges of the Tian Shan across the lake. For the balance of the day we have optional opportunities to walk around the valley and enjoy some of the boat rides being offered at the enchanting IssykKul Lake. Evening we enjoy dinner at a local restaurant attached to the Lake. DAY 17 Morning we visit the Preshevalsky Museum and Monument on the eastern edge of the Lake. A landmark museum, dedicated to the memory of Nikolai MichailovichPreshevalsky, who was an enthusiastic explorer accredited for his excellent works on the flora and fauna of the region. In the afternoon we visit the Annanaeva village where we get the opportunity to hike and visit local families and see their yurt accommodation and enjoy soup and tea with them. Evening for dinner we taste the cuisine of yet another of the popular restaurants at the IssykKul Lake. DAY 18 Enjoy our time at the lake. Afternoon we drive to Bishkek and enjoy a farewell dinner at Captain Nemo Restaurant. We are then transferred to the airport and after an enjoyable trail following the Central Asian portion of the Silk Road, we bid farewell to the land of the Stans.'
},
];
window.onload = function () {
LoadMap();
}
function LoadMap() {
var mapOptions = {
center: new google.maps.LatLng(markers[0].lat, markers[0].lng),
// zoom: 8, //Not required.
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var infoWindow = new google.maps.InfoWindow();
var map = new google.maps.Map(document.getElementById("dvMap"), mapOptions);
//Create LatLngBounds object.
var latlngbounds = new google.maps.LatLngBounds();
for (var i = 0; i < markers.length; i++) {
var data = markers[i]
var myLatlng = new google.maps.LatLng(data.lat, data.lng);
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title: data.title
});
(function (marker, data) {
google.maps.event.addListener(marker, "click", function (e) {
infoWindow.setContent("<div style = 'width:200px;min-height:40px'>" + data.description + "</div>");
infoWindow.open(map, marker);
});
})(marker, data);
//Extend each marker's position in LatLngBounds object.
latlngbounds.extend(marker.position);
}
//Get the boundaries of the Map.
var bounds = new google.maps.LatLngBounds();
//Center map and adjust Zoom based on the position of all markers.
map.setCenter(latlngbounds.getCenter());
map.fitBounds(latlngbounds);
}
</script>
<div id="dvMap" style="width: 1000px; height: 800px">
</div>
</body>
</html>
enter code here
Your markers array is one too long for a single directions request, but the first two points are joined by a flight so you can remove that from the request and draw that as a straight, "as the crow flies" polyline for that, then use the directions service for the remaining locations.
proof of concept fiddle
code snippet:
var map;
function initialize() {
map = new google.maps.Map(
document.getElementById("map_canvas"), {
center: new google.maps.LatLng(37.4419, -122.1419),
zoom: 13,
mapTypeId: google.maps.MapTypeId.ROADMAP
});
var infoWindow = new google.maps.InfoWindow();
//Create LatLngBounds object.
var latlngbounds = new google.maps.LatLngBounds();
var request = {
travelMode: google.maps.TravelMode.DRIVING
};
var polyline = new google.maps.Polyline({
map: map,
geodesic: true,
path: [new google.maps.LatLng(markers[0].lat, markers[0].lng), new google.maps.LatLng(markers[1].lat, markers[1].lng)],
strokeOpacity: 0,
icons: [{
icon: {
path: 'M 0,-1 0,1',
strokeOpacity: 1,
scale: 4
},
offset: '0',
repeat: '20px'
}],
})
var startMarker = new google.maps.Marker({
position: new google.maps.LatLng(markers[0].lat, markers[0].lng),
map: map
})
for (var i = 0; i < markers.length; i++) {
var data = markers[i]
var myLatlng = new google.maps.LatLng(data.lat, data.lng);
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title: data.title
});
(function(marker, data) {
google.maps.event.addListener(marker, "click", function(e) {
infoWindow.setContent("<div style = 'width:200px;min-height:40px'>" + data.description + "</div>");
infoWindow.open(map, marker);
});
})(marker, data);
//Extend each marker's position in LatLngBounds object.
latlngbounds.extend(marker.position);
if (i == 1) {
request.origin = new google.maps.LatLng(markers[i].lat, markers[i].lng);
} else if (i == markers.length - 1) {
request.destination = new google.maps.LatLng(markers[i].lat, markers[i].lng);
} else if (i != 0) {
if (!request.waypoints) request.waypoints = [];
if (request.waypoints.length < 8) {
request.waypoints.push({
location: new google.maps.LatLng(markers[i].lat, markers[i].lng),
stopover: true
});
} else {
alert("too many waypoints, dropping marker number " + i);
}
}
}
var directionsService = new google.maps.DirectionsService();
var directionsDisplay = new google.maps.DirectionsRenderer({
map: map,
suppressMarkers: true
})
directionsService.route(request, function(result, status) {
if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(result);
}
});
}
google.maps.event.addDomListener(window, "load", initialize);
var markers = [{
"title": 'Nusay Hotel, Ashgabat',
"lat": '37.9293938',
"lng": '58.3841203',
"description": 'DAY 01 - DAY 03 Arrive ASHGABAT We are cordially welcomed upon arrival at Ashgabat Airport and then transferred to our hotel. Balance of the day is free at leisure. An ex Soviet state, Turkmenistan is a one party state. Ashgabat, relatively a very small city, offers very interesting sites to see. Resource rich Turkmens have invested in beautifying their capital with a lot of marble of immense size and shapes. Ashgabat was recently noted by the Guinness Book of World Records as having the highest number of white marble-clad buildings in the world - 543 new buildings lined with white marble covering a total area of 4.5 million square meters. DAY 02 ASHGABAT Our study into the heritage of Central Asia starts as we explore the Parthian Fortresses of Nisa*. The site is of one of the earliest and most important cities of the Parthian Empire, a major power from the mid-3rd century BC to the 3rd century AD. Archaeological excavations in two parts of the site have revealed richly decorated architecture, illustrative of domestic, state and religious functions. Situated at the crossroads of important commercial and strategic axes, this powerful empire formed a barrier to Roman expansion while serving as an important communication and trading centre between east and west, north and south. We then head to theSpiritual Mosque, one of the biggest mosques in Central Asia, visit the National Museum of History and continue to Arch of Neutrality. In the afternoon we drive to GeokDepe to visit Arkadash stud farm (subject to opening) to see Akhalteke horses, the pride of Turkmen nation. Our tour concludes with visits to Presidential Square, ErtogrulGhazy Mosque, drive through some of the marble structures and the newly built Independence Park. Dinner tonight will be at the Poytagt Restaurant introducing us to food and cuisines of Central Asia. DAY 03 ASHGABAT/MARY/ASHGABAT An early morning short flight gets us to Mary to visit the State Historical and Cultural Park Ancient Merv*, which is the oldest and best-preserved of the oasis-cities along the Silk Route in Central Asia. The remains in this vast oasis span 4,000 years of human history. A number of monuments are still visible, particularly from the last two millennia, such as the Sultan Sanjar Mausoleum, the Large and Small Gyz Gala, Erk Gala, Gyaur Gala, Keshk Fortress, among others. On our way back to Mary we visit an artist’s home to see a demonstration of carpet weaving, embroidery, painting, cooking of local bread. After lunch we take our flight back to Ashgabat. Evening free.'
}, {
"title": 'JipekJoli Hotel, Nukus',
"lat": '42.465825',
"lng": '59.607718',
"description": 'DAY 04 After a short flight to Dashoguz we head to Kunya-Urgench*, situated in on the left bank of the Amu Daria River. The old town contains a series of monuments mainly from the 11th to 16th centuries, including a mosque, the gates of a caravanserai, fortresses, mausoleums and a 60-m high minaret. The monuments testify to outstanding achievements in architecture and craftsmanship whose influence reached Iran and Afghanistan, and later the architecture of the Mogul Empire of 16th-century India. After our visit of KunyaUrgench we drive to the Turkmenistan-Uzbekistan border point at Khojeyli, where we go through border formalities on both checkpoints, whilst being an interesting experience they do lack modern facilities. A short drive viewing the countryside gets us to Nukus – a place that is almost lost in the middle of the desert.'
}, {
"title": 'Grand Abdi Malik Hotel, Khiva',
"lat": '41.377115',
"lng": '60.3580361',
"description": 'DAY 05 Morning we visit the SavitskyKarakalpakstan Art Museum, which hosts the worlds second largest collection of Russian avant-garde art applied arts objects. It is also home to one of the largest collections of archeological objects and folk, applied and contemporary art originating from Central Asia. Drive through rural Uzbekistan to the historical city of Khiva. Here we explore the Ichan-Kala - the inner town (protected by brick walls some 10 m high) of the old Khiva oasis, which was the last resting-place of caravans before crossing the desert to Iran. Although few very old monuments still remain, it is a coherent and well-preserved example of the Muslim architecture of Central Asia. There are several outstanding structures such as the Djuma Mosque, the mausoleums and the madrasas and the two magnificent palaces built at the beginning of the 19th century by Alla-Kulli-Khan. Dinner at the popular Yassaulbashi restaurant.'
}, {
"title": 'Omar Khayyam Hotel, Bukhara',
"lat": '39.7703649',
"lng": '64.4149347',
"description": 'DAY 06 - DAY 07 A short drive to Urgench the capital of Khorezm province. It has a population of 150,000 inhabitants. We will have a drive through of the city before talking our flight to the historical Silk Road city of Bukhara. Upon arrival at Bukhara the most well known of the Silk Road oasis dating back to over 2,000 years. It is the most complete example of a medieval city in Central Asia, with an urban fabric that has remained largely intact. Monuments of particular interest include the famous tomb of Ismail Samani, a masterpiece of 10th-century Muslim architecture, and a large number of 17th-century madrasas. Afternoon we enjoy a walking tour of Bukhara, visiting several mosques, madrasas and the hat seller’s market. Evening we enjoy a folklore show at the Devanbegi Madrasa. End the day the Bukharan style with dinner enjoying Bukharan cuisine at the Minzifa Restaurant located in the Old Town. DAY 07 Today we continue our tour through the Historic Centre of Bukhara*, which houses over 140 architectural monuments. Bukhara had narrow streets will remind us of the Arabian Nights. After seeing the historical sites we visit Akbar’s Gallery where one can seea rich collection of old carpets and suzzane – his display center is like a museum assisted by UNESCO – his collection is well known to the Metropolitan Museum. To culminate our Bukhara experience we visit a miniaturist house where we see the workshop of the painters and his students all trying to retain the traditional art. Miniature painting was introduced here from Persia and the same tradition continued for many years but is facing its challenges with modernity. We join in for a home cooked meal.'
}, {
"title": 'Grand Samarkand Hotel, Samarkand',
"lat": '39.6725002',
"lng": '66.9364854',
"description": 'DAY 08 - DAY 09 Yet another tour of the historical city visiting the SitoraiMokhi-Khosa Palace followed by the residence of the Emir of Bukhara, the Mausoleum of the Sufi BakhoutdinNaqshbandi and the ChorBakr Necropolis. As we continue to Samarkand we stop atGijduvon to visit a famous madrassa built by Ulugh Beg the Timurid Sultan, astronomer and mathematician. We also visit the tomb and memorial of the prominent philosopher AbduholikGijduvoni, after whom the city is named. An interesting insight to the arts of Uzbekistan as we visit the famous pottery works of Alisher well known for his unique style and color. Past famous visitors include Prince Charles, Lady Diana and Hillary Clinton. Arrival Samarkand late afternoon. Evening, after some free time to stroll through the lanes of this historical city we are treated to dinner at the famous Old City Restaurant of Samarkand. DAY 09 This day is dedicated to explore the Historic town of Samarkand* - a crossroad and melting pot of the worlds cultures. Founded in the 7th century B.C. as ancient Afrasiab, Samarkand had its most significant development in the Timurid period from the 14th to the 15th centuries. The major monuments include the Registan Mosque and madrasas, Bibi-Khanum Mosque, the Shakhi-Zinda compound and the Gur-Emir ensemble, as well as Ulugh-Begs Observatory. Time permitting we visit a family home to learn how the most popular Uzbek meal, the pulao, is cooked. Evening is free and you may visit the local Afghan carpet makers, the local winery, the Kunhil paper makers or just back into time.'
}, {
"title": 'ShakreSabz Star Hotel, Shakhrisyabz',
"lat": '39.0400391',
"lng": '66.8069597',
"description": 'DAY 10 Morning we tour the Afrosiyob Museum and the tomb of Saint Daniel. Then we drive to KoniGhil village to see the traditional way of making Samarkand paper from mulberry leaves. Continue to the Historic Centre of Shakhrisyabz*, the birthplace of Tamerlane. The city contains a collection of exceptional monuments and ancient quarters that bear witness to the citys secular development, and particularly to the period of its apogee, under the rule of Amir Temur and the Temurids, in the 15th-16th century. Dinner will be a local experience at Alisher’s House. Evening free.'
}, {
"title": 'Serena Hotel, Dushanbe',
"lat": '38.5142164',
"lng": '68.7511861',
"description": 'DAY 11 - DAY 12 An early morning departure as we drive to the capital city of Tajikistan. Upon arrival at the border we first complete exit border formalities of Uzbekistan and then a short walk across to the Tajik side to do the entry border formalities. Change of vehicles as we drive to Dushanbe. We arrive at Dushanbe and are transferred to our hotel. Tajikistan is a double landlocked country, which was part of the Soviet Union and now has a Presidential form of government. It has a population of 8 million. Evening we are treated to Turkish/Tajik local cuisine dinner at the Café Merve Turkish. DAY 12 Our day in Dushanbe is spent visiting the National Museum of Tajikistan, the Gurminj Musical Instruments Museum, Statue of Ismail Samani and Rudaki Park. Subject to permit we also visit the recently built and an architectural marvel, the IsmailiJamatkhan and Centre. Lunch is at the Traktir Restaurant known for its speciality of Ukranian cuisine. We then visit the Botanical Gardens and culminate with an experience of the local bazaar. Evening is free to stroll the street and meet the friendly Tajiks at the teahouses.'
}, {
"title": 'Lotte Hotel, Tashkent',
"lat": '41.309827',
"lng": '69.2665513',
"description": 'DAY 13 We explore Uzbekistan’s capital visiting the Old City, including the Khast-Imom Complex where the world famous Quran of Caliph Uthman/Ottoman has been preserved, the Madrasah of Barak-Khan, Tilla Sheikh Mosque, the Mausoleum of the Saint Abu BakrKaffalShashi, the Islamic Institute of Imam al-Bukhari and explore Chor-Su Bazaar. An evening flight gets us to the largest and until recently the capital city of Kazakhstan. Upon arrival at Alma Aty we are welcomed and transferred to our hotel.'
}, {
"title": 'Otrar Hotel, Almaty',
"lat": '43.2608189',
"lng": '76.9495966',
"description": 'DAY 14 An early morning departure as we drive to the capital city of Tajikistan. Upon arrival at the border we first complete exit border formalities of Uzbekistan and then a short walk across to the Tajik side to do the entry border formalities. Change of vehicles as we drive to Dushanbe. We arrive at Dushanbe and are transferred to our hotel. Tajikistan is a double landlocked country, which was part of the Soviet Union and now has a Presidential form of government. It has a population of 8 million. Evening we are treated to Turkish/Tajik local cuisine dinner at the Café Merve Turkish.'
}, {
"title": 'Ak-Keme Hotel, Bishkek',
"lat": '42.8375965',
"lng": '74.5818513',
"description": 'DAY 15 We start early today on what is going to be a long day. Our tour begins with a visit to the Panfilov Park, followed by Zenkov Cathedral, St. Nicholas Cathedral and the Green Bazaar. From here we drive through Chang an-Tianshan Corridor*. We visit the Petroglyphs within the Archaeological Landscape of Tamgaly*. Set around the lush Tamgaly Gorge, amidst the vast, arid Chu-Ili Mountains, is a remarkable concentration of some 5,000 petroglyphs (rock carvings) dating from the second half of the second millennium BC to the beginning of the 20th century. Distributed among 48 complexes with associated settlements and burial grounds, they are testimonies to the husbandry, social organization and rituals of pastoral peoples. From here we drive to the border to Kyrgyzstan and continue to our hotel in Bishkek. Known alsos as Furunze, Bishkek is the capital city of Kyrgyzstan. Lunch will be at the Arzu Restaurant.'
}, {
"title": 'Four Seasons Karven Resort, IssykKul Lake',
"lat": '42.6035605',
"lng": '76.936764',
"description": 'DAY 16 - DAY 18 We enjoy our tour of Bishkek, which includes visits to Oak Park, Ala-Too Square, Statue of Manas, the Philharmonic Hall and Victory Monument. Drive to Balasagun and visit the historical Burana Tower*, which dates back to the 9th century AD. We will also visit the nearby museum. We then proceed eastwards into the mountains to Cholpon-Ata where we visit the local rock drawings of the Bronze periods, the local museum and a small local bazaar before arriving at our resort at Central Asia’s most popular will known resort. The Four Season’s Karven is known also for its impressive views of the imposing alpine ranges of the Tian Shan across the lake. For the balance of the day we have optional opportunities to walk around the valley and enjoy some of the boat rides being offered at the enchanting IssykKul Lake. Evening we enjoy dinner at a local restaurant attached to the Lake. DAY 17 Morning we visit the Preshevalsky Museum and Monument on the eastern edge of the Lake. A landmark museum, dedicated to the memory of Nikolai MichailovichPreshevalsky, who was an enthusiastic explorer accredited for his excellent works on the flora and fauna of the region. In the afternoon we visit the Annanaeva village where we get the opportunity to hike and visit local families and see their yurt accommodation and enjoy soup and tea with them. Evening for dinner we taste the cuisine of yet another of the popular restaurants at the IssykKul Lake. DAY 18 Enjoy our time at the lake. Afternoon we drive to Bishkek and enjoy a farewell dinner at Captain Nemo Restaurant. We are then transferred to the airport and after an enjoyable trail following the Central Asian portion of the Silk Road, we bid farewell to the land of the Stans.'
}, ];
html,
body,
#map_canvas {
height: 100%;
width: 100%;
margin: 0px;
padding: 0px
}
<script src="https://maps.googleapis.com/maps/api/js"></script>
<div id="map_canvas"></div>

Loading html data in Web View?

<p>kick 2 first look on republic day According to the latest update, the first look of the film Kick 2 will be released on 26th of January. Regular shooting of this film is going on at a brisk pace in Hyderabad. Rakul Preet is playing the female lead in this film and Thaman is scoring ...</p>
<p>The post <a rel="nofollow" href="http://www.teluguabroad.com/kick-2-first-look-republic-day/">kick 2 first look on republic day</a> appeared first on <a rel="nofollow" href="http://www.teluguabroad.com">Teluguabroad</a>.</p>
how to display this in web view and i was getting it from rss feed? to display that content in the next view controller having web view?
You need to set up a html string and then you can load this on web view.
NSString *rssString=[NSString stringWithFormat:#"<p>kick 2 first look on republic day According to the latest update, the first look of the film Kick 2 will be released on 26th of January. Regular shooting of this film is going on at a brisk pace in Hyderabad. Rakul Preet is playing the female lead in this film and Thaman is scoring ...</p><p>The post <a rel=\"nofollow\" href=\"http://www.teluguabroad.com/kick-2-first-look-republic-day/\">kick 2 first look on republic day</a> appeared first on <a rel=\"nofollow\" href=\"http://www.teluguabroad.com\">Teluguabroad</a>.</p>"];
NSString *myHTML = [NSString stringWithFormat:#"<html><body>%#</body></html>",rssString];
[myUIWebView loadHTMLString:myHTML baseURL:nil];
Also notice that for every double quotes " used in NSString we have appended a single slash'\'. So that Xcode compiler can understand that these double quotes are a part of string and will not confuse NSString with #" " identifier which we use in Xcode.
And in case you need to load this to next view controller, you can send the string myHTMl to next view controller using property and load on web view .

how to display data in html

In my project, I am retrieving an address from the database and displaying this address on page. The issue or problem that I am facing is the the way the retrieved address is being displayed.
Basically this is the way the address is being displayed:
Address: 1 Kings Street Kilmarnock East Berkshire Scotland KA1 UIT
I would like the address to be displayed like so:
Address: 1 Kings Street
Kilmarnock
East Berkshire
Scotland
KA1 UIT
How can I do this in HTML or css? I am currently using twitter bootstrap , and I don't if there is anyway to do using it.
Oh.. It's hard but let me try... ;)
<div>Address: 1 Kings Street<br> Kilmarnock <br>East Berkshire<br> Scotland <br>KA1 UIT</div>
Your Expected Output:
Address: 1 Kings Street
Kilmarnock
East Berkshire
Scotland
KA1 UIT
Working Demo
Note: This is just simplest and basic way.. But if Data is coming from any database dynamically then at-least you should explain in details from where it comes and by which object it can be accessible.. Then you can apply JS or regex functions... I hope you understand what I mean..
If you edited the data in your database, and used a comma between each line, you might be able to split the data. (your question doesn't state what language you are writing in (mvc/how data is being received).
However, once you have the string, you can use the String.split method (available in most languages), and hence could adapt your view accordingly.
So,
Address: 1 Kings Street, Kilmarnock, East Berkshire, Scotland, KA1 UIT
would become
{1 Kings Street}{ Kilmarnock}{ East Berkshire}{ Scotland}{ KA1 UIT}
which you could then do a foreach block, displaying them onto the screen as you requested
A possible alternative (although probably not easy), would be to extract the postcode, and call a google maps API call to receive the address - but again, this would be quite difficult.
At present, I cannot see how you would be able to expect a program to decide where to split the address into separate lines (unless you place them into different fields which was described in the comments).
You can add <p> to each line, or put <br> at the end of each lines.
But
If your retrieving the data from a database through a php variable you cannot do that with pure html / css, you'll need string manipulation with PHP.

UITextView: Replace Special Characters [duplicate]

in xml data is
<content_special>
SAT 17TH TEST test club cheap drinks £3 shots £5 bottles $beers
</content_special>
i get this string using this code
TBXMLElement *Content_Special=[TBXML childElementNamed:#"content_special" parentElement:Club];
NSString *Content_SpecialStr = [TBXML textForElement:Content_Special];
when i NSLog(#"Content_special:%#",Content_SpecialStr);
that print like this
Content_special:SAT 17TH TEST
test club
cheap drinks
£3 shots
£5 bottles
$beers
how can i get original sting which Display in Xlm ? Any suggestion...
Found Solution Using Google Toolbox for Mac GTMNSString+HTML.h ,GTMNSString+HTML.m And GTMDefines.h,
First #import "GTMNSString+HTML.h"
use like This: Content_SpecialStr = [Content_SpecialStr gtm_stringByUnescapingFromHTML];
Ensure your data xml file has utf-8 encoding http://www.w3schools.com/xml/xml_encoding.asp

HTML String in JSON

I know it isn’t the best idea to have html in your JSON but sadly I am not in control of this database or this website and am not given those privileges! I am making google maps markers and one of the values is corrupting the data and not being processed right. I know the issue is in the DESC value, is there some sort of character that isn’t escaped? Because almost all of the other objects in the JSON work just fine besides this one.
{"PHONE":"847-509-2000”,
"LAT":42.15223,
"STATE":"IL”,
"ZIP":60015.0,
"NAME":"DC Sarnies”,
"DESC":"Opening in early May 2011, D.C. Sarnies is a contemporary but casual restaurant
specializing in sandwiches and classic American food with a twist. As well as a
restaurant, we serve as a research and development kitchen for its parent company,
Highland Baking Company. Guest chefs and bakery clients will have the opportunity to try
out new products and let diners provide feedback on the dishes. The menu at D. C. Sarnies
has something for everyone with a wide variety of appetizers, soups, salads, entrees and
signature sandwiches and burgers to choose from. A full bar also gives diners a wide range
of craft beers including more than 25 on tap, wine and cocktails. For more information
visit us on Facebook at D.C. Sarnies or on Twitter DC_Sarnies.”,
"LONG":-87.84241,
"CITY":"Deerfield”,
"ADDR":"649 Lake Cook Road”,
"PHOTO":"DCcrabcakeburger.jpg”}]
jsonlint error message: Parse error on line 74:
...02, "DESC": "Opening in early Ma
----------------------^
Expecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '['
http://jsonlint.org/ use this website to validate your JSON.
The problem here are the closing quotes you use for strings, they're invalid.
End double quotes wrong. Rest everything is fine and working.
The double quotes at the end of the values are the problem. They're the wrong character.
There are a couple issues:
Different quotes used. ” is different from ".
Multi-line isn't escaped. If you need the line breaks, use \n. Otherwise, just have it one line
The extra ] at the end shouldn't be there
This is what you should have:
{
"PHONE": "847-509-2000",
"LAT": 42.15223,
"STATE": "IL",
"ZIP": 60015,
"NAME": "DC Sarnies",
"DESC": "Opening in early May 2011, D.C. Sarnies is a contemporary but casual restaurant specializing in sandwiches and classic American food with a twist. As well as a restaurant, we serve as a research and development kitchen for its parent company, Highland Baking Company. Guest chefs and bakery clients will have the opportunity to try out new products and let diners provide feedback on the dishes. The menu at D. C. Sarnies has something for everyone with a wide variety of appetizers, soups, salads, entrees and signature sandwiches and burgers to choose from. A full bar also gives diners a wide range of craft beers including more than 25 on tap, wine and cocktails. For more information visit us on Facebook at D.C. Sarnies or on Twitter DC_Sarnies.",
"LONG": -87.84241,
"CITY": "Deerfield",
"ADDR": "649 Lake Cook Road",
"PHOTO": "DCcrabcakeburger.jpg"
}