Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7128325
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T11:07:37+00:00 2026-05-28T11:07:37+00:00

I’m implementing Google Maps service with PHP/CURL and currently have a problem with Maps

  • 0

I’m implementing Google Maps service with PHP/CURL and currently have a problem with Maps API.
I am sending queries to Google Maps with English and Russian addresses.
English address works fine, while Russian address fails with 602 (address not found)

Weird thing is that if I copy-paste curl query with Russian address to browser, it works fine (returns 200 and coords).

My code is

public static function google_geolocator($geoloc){
    $geoloc = urlencode(implode(" ",$geoloc));
    $query = "http://maps.google.com/maps/geo?q={$geoloc}&sensor=true&oe=utf8";
    echo $query;
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, $query);
    curl_setopt($curl, CURLOPT_HEADER, 0);
    curl_setopt($curl, CURLOPT_FAILONERROR, TRUE);
    curl_setopt($curl, CURLOPT_VERBOSE, TRUE);      
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
    $json = curl_exec($curl);
    curl_close($curl);
    $data = json_decode($json, TRUE);
    return $data;
}

I searched through Internets and figured out some hacks with User-Agent and &oe=utf8 and so on, but none of those seem to work. The main thing that confuses me, again, is that this method works perfectly with address in English, but fails with Russian. Although pasting query into browser works perfect in both cases.

Thank you in advance!

small update: query like

http://maps.google.com/maps/geo?q=%D0%A2%D0%B0%D0%B8%D0%BB%D0%B0%D0%BD%D0%B4+%D0%9A%D0%BE+%D0%9F%D1%85%D1%83%D0%BA%D0%B5%D1%82&sensor=true&oe=utf8

works in Chrome, but doesn’t work in Firefox (same 602), while

http://maps.google.com/maps/geo?q=Thailand+Koh+Phuket&sensor=true&oe=utf8

works fine in both

upd2
var_dumping($data) returns

{
"name": "Таиланд Ко Пхукет",
"Status": {
    "code": 602,
    "request": "geocode"
    }
}

and name field is absolutely the same as in Chrome response.

upd3 alright, the thing is if i change location name in Russian slightly, both Chrome and FF return 200 and coordinates. The problem seems to be that Chrome is bit more “intellectual” while communicating with Google. Refactored method so location names are always provided in English no matter what current locale is. Looks like it’s better not to mess with Google and character sets different from English.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T11:07:37+00:00Added an answer on May 28, 2026 at 11:07 am

    The main thing that confuses me, again, is that this method works perfectly with address in English, but fails with Russian.

    You are telling Google to expect UTF-8 data, but you’re probably sending it something else. UTF-8 is a double-byte encoding – plain old ASCII characters consist of one byte, just as in ASCII; Russian and other characters of two or more. That’s why the English alphabet often works, but as soon as other characters come into play, things break. Most likely, your Cyrillic characters are getting garbled (= stored as an encoding other than UTF-8) somewhere along the way, before they enter your query.

    Make sure the values in $geoloc are UTF-8 encoded. If they come from a file, make sure that is UTF-8 encoded. If they come from a database, make sure the tables and the database connection are UTF-8 encoded.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making a simple page using Google Maps API 3. My first. One marker
this is what i have right now Drawing an RSS feed into the php,
I am currently running into a problem where an element is coming back from
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I have a jquery bug and I've been looking for hours now, I can't
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.