{"id":23051,"date":"2022-11-23T11:38:03","date_gmt":"2022-11-23T06:08:03","guid":{"rendered":"https:\/\/jassweb.com\/solved\/solved-programatically-search-a-place-in-google-map-api-by-passing-place-name\/"},"modified":"2022-11-23T11:38:03","modified_gmt":"2022-11-23T06:08:03","slug":"solved-programatically-search-a-place-in-google-map-api-by-passing-place-name","status":"publish","type":"post","link":"https:\/\/jassweb.com\/solved\/solved-programatically-search-a-place-in-google-map-api-by-passing-place-name\/","title":{"rendered":"[Solved] programatically search a place in google map API by passing place name"},"content":{"rendered":"<p> [ad_1]<br \/>\n<\/p>\n<div id=\"answer-37209082\" class=\"answer js-answer accepted-answer js-accepted-answer\" data-answerid=\"37209082\" data-parentid=\"37158199\" data-score=\"0\" data-position-on-page=\"1\" data-highest-scored=\"1\" data-question-has-accepted-highest-score=\"1\" itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n<div class=\"post-layout\">\n<div class=\"votecell post-layout--left\"><\/div>\n<div class=\"answercell post-layout--right\">\n<div class=\"s-prose js-post-body\" itemprop=\"text\">\n<p>using JSON<\/p>\n<pre><code>&lt;?php\nfunction geoPlaceID($location)\n{\n   $locationclean = str_replace (\" \", \"+\", $location);\n   $details_url = \"https:\/\/maps.googleapis.com\/maps\/api\/place\/textsearch\/json?query=\" . $locationclean . \"&amp;key=YOUR_KEY\";\n   $du = file_get_contents($details_url);\n\n   $getDetails = json_decode(utf8_encode($du),true);\n   if ($getDetails['status']==\"OK\")\n   {\n       $a=$getDetails['results'][1]['types'];\n       print_r($a);\n      \/\/ echo implode(\" \",$a).\"&lt;br&gt;\";\n   }\n   else\n   {\n       echo \"Place ID not found\";\n   }\n}\ngeoPlaceID(\"kfc\");\n ?&gt;\n<\/code><\/pre>\n<p>using XML<\/p>\n<pre><code>&lt;?php\n\nfunction place_ID($location)\n{\n$locationclean = str_replace (\" \", \"+\", $location);\n$data = \"https:\/\/maps.googleapis.com\/maps\/api\/place\/textsearch\/xml?query=\" . $locationclean . \"&amp;key=YOUR_KEY\";\n\n$xml = file_get_contents($data);\n$xml = simplexml_load_string($xml);\n\nforeach($xml-&gt;result-&gt;type as $key =&gt; $value){\n    $location_id = $value;\n    echo $location_id;\n    echo \"&lt;br&gt;\";\n}\n}\nplace_ID(\"kfc\");\n\n?&gt;\n<\/code><\/pre>\n<\/p><\/div>\n<div class=\"mt24\"><\/div>\n<\/div>\n<p>            <span class=\"d-none\" itemprop=\"commentCount\"><\/span> <\/p><\/div>\n<\/div>\n<p>[ad_2]<\/p>\n<p>solved programatically search a place in google map API by passing place name <\/p>\n","protected":false},"excerpt":{"rendered":"<p>[ad_1] using JSON &lt;?php function geoPlaceID($location) { $locationclean = str_replace (&#8221; &#8220;, &#8220;+&#8221;, $location); $details_url = &#8220;https:\/\/maps.googleapis.com\/maps\/api\/place\/textsearch\/json?query=&#8221; . $locationclean . &#8220;&amp;key=YOUR_KEY&#8221;; $du = file_get_contents($details_url); $getDetails = json_decode(utf8_encode($du),true); if ($getDetails[&#8216;status&#8217;]==&#8221;OK&#8221;) { $a=$getDetails[&#8216;results&#8217;][1][&#8216;types&#8217;]; print_r($a); \/\/ echo implode(&#8221; &#8220;,$a).&#8221;&lt;br&gt;&#8221;; } else { echo &#8220;Place ID not found&#8221;; } } geoPlaceID(&#8220;kfc&#8221;); ?&gt; using XML &lt;?php function place_ID($location) { $locationclean &#8230; <a title=\"[Solved] programatically search a place in google map API by passing place name\" class=\"read-more\" href=\"https:\/\/jassweb.com\/solved\/solved-programatically-search-a-place-in-google-map-api-by-passing-place-name\/\" aria-label=\"More on [Solved] programatically search a place in google map API by passing place name\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[320],"tags":[492,5003,1322,720],"class_list":["post-23051","post","type-post","status-publish","format-standard","hentry","category-solved","tag-google-maps","tag-google-maps-api-2","tag-google-maps-api-3","tag-search"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>[Solved] programatically search a place in google map API by passing place name - JassWeb<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/jassweb.com\/solved\/solved-programatically-search-a-place-in-google-map-api-by-passing-place-name\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"[Solved] programatically search a place in google map API by passing place name - JassWeb\" \/>\n<meta property=\"og:description\" content=\"[ad_1] using JSON &lt;?php function geoPlaceID($location) { $locationclean = str_replace (&quot; &quot;, &quot;+&quot;, $location); $details_url = &quot;https:\/\/maps.googleapis.com\/maps\/api\/place\/textsearch\/json?query=&quot; . $locationclean . &quot;&amp;key=YOUR_KEY&quot;; $du = file_get_contents($details_url); $getDetails = json_decode(utf8_encode($du),true); if ($getDetails[&#039;status&#039;]==&quot;OK&quot;) { $a=$getDetails[&#039;results&#039;][1][&#039;types&#039;]; print_r($a); \/\/ echo implode(&quot; &quot;,$a).&quot;&lt;br&gt;&quot;; } else { echo &quot;Place ID not found&quot;; } } geoPlaceID(&quot;kfc&quot;); ?&gt; using XML &lt;?php function place_ID($location) { $locationclean ... Read more\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jassweb.com\/solved\/solved-programatically-search-a-place-in-google-map-api-by-passing-place-name\/\" \/>\n<meta property=\"og:site_name\" content=\"JassWeb\" \/>\n<meta property=\"article:published_time\" content=\"2022-11-23T06:08:03+00:00\" \/>\n<meta name=\"author\" content=\"Kirat\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Kirat\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/solved-programatically-search-a-place-in-google-map-api-by-passing-place-name\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/solved-programatically-search-a-place-in-google-map-api-by-passing-place-name\\\/\"},\"author\":{\"name\":\"Kirat\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#\\\/schema\\\/person\\\/65c9c7b7958150c0dc8371fa35dd7c31\"},\"headline\":\"[Solved] programatically search a place in google map API by passing place name\",\"datePublished\":\"2022-11-23T06:08:03+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/solved-programatically-search-a-place-in-google-map-api-by-passing-place-name\\\/\"},\"wordCount\":32,\"publisher\":{\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#organization\"},\"keywords\":[\"google-maps\",\"google-maps-api-2\",\"google-maps-api-3\",\"search\"],\"articleSection\":[\"Solved\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/solved-programatically-search-a-place-in-google-map-api-by-passing-place-name\\\/\",\"url\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/solved-programatically-search-a-place-in-google-map-api-by-passing-place-name\\\/\",\"name\":\"[Solved] programatically search a place in google map API by passing place name - JassWeb\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#website\"},\"datePublished\":\"2022-11-23T06:08:03+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/solved-programatically-search-a-place-in-google-map-api-by-passing-place-name\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jassweb.com\\\/solved\\\/solved-programatically-search-a-place-in-google-map-api-by-passing-place-name\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/solved-programatically-search-a-place-in-google-map-api-by-passing-place-name\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"[Solved] programatically search a place in google map API by passing place name\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#website\",\"url\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/\",\"name\":\"JassWeb\",\"description\":\"Build High-quality Websites\",\"publisher\":{\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#organization\",\"name\":\"Jass Web\",\"url\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/jassweb.com\\\/wp-content\\\/uploads\\\/2021\\\/02\\\/jass-website-logo-1.png\",\"contentUrl\":\"https:\\\/\\\/jassweb.com\\\/wp-content\\\/uploads\\\/2021\\\/02\\\/jass-website-logo-1.png\",\"width\":693,\"height\":132,\"caption\":\"Jass Web\"},\"image\":{\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#\\\/schema\\\/person\\\/65c9c7b7958150c0dc8371fa35dd7c31\",\"name\":\"Kirat\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/wp-content\\\/litespeed\\\/avatar\\\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1777613206\",\"url\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/wp-content\\\/litespeed\\\/avatar\\\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1777613206\",\"contentUrl\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/wp-content\\\/litespeed\\\/avatar\\\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1777613206\",\"caption\":\"Kirat\"},\"sameAs\":[\"http:\\\/\\\/jassweb.com\"],\"url\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/author\\\/jaspritsinghghumangmail-com\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"[Solved] programatically search a place in google map API by passing place name - JassWeb","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/jassweb.com\/solved\/solved-programatically-search-a-place-in-google-map-api-by-passing-place-name\/","og_locale":"en_US","og_type":"article","og_title":"[Solved] programatically search a place in google map API by passing place name - JassWeb","og_description":"[ad_1] using JSON &lt;?php function geoPlaceID($location) { $locationclean = str_replace (\" \", \"+\", $location); $details_url = \"https:\/\/maps.googleapis.com\/maps\/api\/place\/textsearch\/json?query=\" . $locationclean . \"&amp;key=YOUR_KEY\"; $du = file_get_contents($details_url); $getDetails = json_decode(utf8_encode($du),true); if ($getDetails['status']==\"OK\") { $a=$getDetails['results'][1]['types']; print_r($a); \/\/ echo implode(\" \",$a).\"&lt;br&gt;\"; } else { echo \"Place ID not found\"; } } geoPlaceID(\"kfc\"); ?&gt; using XML &lt;?php function place_ID($location) { $locationclean ... Read more","og_url":"https:\/\/jassweb.com\/solved\/solved-programatically-search-a-place-in-google-map-api-by-passing-place-name\/","og_site_name":"JassWeb","article_published_time":"2022-11-23T06:08:03+00:00","author":"Kirat","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Kirat","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jassweb.com\/solved\/solved-programatically-search-a-place-in-google-map-api-by-passing-place-name\/#article","isPartOf":{"@id":"https:\/\/jassweb.com\/solved\/solved-programatically-search-a-place-in-google-map-api-by-passing-place-name\/"},"author":{"name":"Kirat","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31"},"headline":"[Solved] programatically search a place in google map API by passing place name","datePublished":"2022-11-23T06:08:03+00:00","mainEntityOfPage":{"@id":"https:\/\/jassweb.com\/solved\/solved-programatically-search-a-place-in-google-map-api-by-passing-place-name\/"},"wordCount":32,"publisher":{"@id":"https:\/\/jassweb.com\/solved\/#organization"},"keywords":["google-maps","google-maps-api-2","google-maps-api-3","search"],"articleSection":["Solved"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/jassweb.com\/solved\/solved-programatically-search-a-place-in-google-map-api-by-passing-place-name\/","url":"https:\/\/jassweb.com\/solved\/solved-programatically-search-a-place-in-google-map-api-by-passing-place-name\/","name":"[Solved] programatically search a place in google map API by passing place name - JassWeb","isPartOf":{"@id":"https:\/\/jassweb.com\/solved\/#website"},"datePublished":"2022-11-23T06:08:03+00:00","breadcrumb":{"@id":"https:\/\/jassweb.com\/solved\/solved-programatically-search-a-place-in-google-map-api-by-passing-place-name\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jassweb.com\/solved\/solved-programatically-search-a-place-in-google-map-api-by-passing-place-name\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/jassweb.com\/solved\/solved-programatically-search-a-place-in-google-map-api-by-passing-place-name\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/jassweb.com\/solved\/"},{"@type":"ListItem","position":2,"name":"[Solved] programatically search a place in google map API by passing place name"}]},{"@type":"WebSite","@id":"https:\/\/jassweb.com\/solved\/#website","url":"https:\/\/jassweb.com\/solved\/","name":"JassWeb","description":"Build High-quality Websites","publisher":{"@id":"https:\/\/jassweb.com\/solved\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/jassweb.com\/solved\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/jassweb.com\/solved\/#organization","name":"Jass Web","url":"https:\/\/jassweb.com\/solved\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/","url":"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png","contentUrl":"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png","width":693,"height":132,"caption":"Jass Web"},"image":{"@id":"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31","name":"Kirat","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1777613206","url":"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1777613206","contentUrl":"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1777613206","caption":"Kirat"},"sameAs":["http:\/\/jassweb.com"],"url":"https:\/\/jassweb.com\/solved\/author\/jaspritsinghghumangmail-com\/"}]}},"_links":{"self":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts\/23051","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/comments?post=23051"}],"version-history":[{"count":0,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts\/23051\/revisions"}],"wp:attachment":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/media?parent=23051"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/categories?post=23051"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/tags?post=23051"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}