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

  • SEARCH
  • Home
  • 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 8831993
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T08:25:53+00:00 2026-06-14T08:25:53+00:00

I need to make a get request to google places api however I can’t

  • 0

I need to make a get request to google places api however I can’t use just javascript because it does not support jsonp. I read that I could do a get request using a php file and then do a normal jquery ajax call to that in order to get the json data. However I created the php file using

<?php
echo file_get_contents("https://maps.google...");
?>

and then using a jquery ajax request to this file hosted on my http:localhost/ server on my ubuntu distro, yet i am getting a 500 http server error. What am I doing wrong or how do I go about doing this correctly?

</script>

      <script>
      $(document).ready(function(){

      $.ajax({
      url: 'http://localhost/places.php',
      dataType: "json",
      type: "GET",
      success: function( data){
      document.getElementById("paragraph").innerHTML= data.result[0].name;
      },
      error: function(request, status, error){
      document.getElementById("paragraph").innerHTML= "error";
      }
      })


      });

</script>
    <body>
    <p id="paragraph">
       Untouched Text.
    </p>
    <button id="b1">Click Me!</button>
    </body>

The only error message I get using firebug is 500 Internal Server Error so I don’t think its my html, javascript, or jquery.

  • 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-06-14T08:25:54+00:00Added an answer on June 14, 2026 at 8:25 am

    You are calling Google API and must return a JSON, so this ought to be enough:

    <?php
        $json = file_get_contents("http://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=true_or_false");
    
        $data = json_decode($json);
    
        // manipulate data and rebuild json with $json = json_encode($data) if needed
    
        Header("Content-Type: application/json");
        die($json);
    ?>
    

    This works, in that Google answers me with a correctly formed, if succinct, JSON:

    {
    
        "results": [ ],
        "status": "REQUEST_DENIED"
    }
    

    With proper API Key configuration you ought to get this working. Check that the call is working in your browser (without cookies, etc. – a clean session, which is what file_get_contents() is going to give you) and that your PHP installation is capable of recovering SSL data (it should, but let’s check), i.e.,

    file_get_contents("https://www.google.com/");
    

    ought to recover Google’s home page.

    This call needs no authentication (there’s a rate limit, but I think it’s unlikely you’ll be making all the calls required to get you shut out):

    http://maps.googleapis.com/maps/api/directions/json?origin=Toronto&destination=Montreal&sensor=false
    

    The above will return a very complex JSON with possibly accented characters in. Now that I come to think of it, the Header above would be better like this:

        Header('Content-Type: application/json;charset=UTF-8');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I try to make a apps that need barcode scanner, i already can get
I am trying to make a simple request using http.get. But I need to
I am developing a Google Chrome extension, and need to use the chrome.experimental.webRequest API.
Currently i need to make an application that can list all of Google Drive
Ok. I need to do something like this: 1) Make a GET ajax request
I need to make simple CRUD web app (i'll get paid for it), but
I need to get a list of tags in a text, make their contents
I need make all of my posts update. I use bulk upload for store,
I would like to make a http get request with my Android phone (i
I am trying to make an application connect to Google Plus API, but for

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.