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 6112815
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:47:16+00:00 2026-05-23T14:47:16+00:00

I am having trouble getting some data from a JSON object which I have

  • 0

I am having trouble getting some data from a JSON object which I have converted into an array:

This is my Class:

class tbfe_json_api {

    var $location;
    var $latitude;
    var $longitude;
    var $searchRadius = 20; // Default to 20 Miles
    var $reverseGeoCodeJSON;

    public function __construct() {

        $this->getLocationParams(); 

        $this->getCoords( $this->reverseGeoCodeLocation( $this->location ) );

    }

    public function getLocationParams() {

        if( isset( $_GET['location'] ) ) {  

            $this->location = str_replace(' ', '' , $_GET['location'] );

            if( isset( $_GET['radius'] ) ) {
                $this->searchRadius = $_GET['radius'];
            }   

        }
        else {
            die('Invalid parameters specified for JSON request.');
        }

    }

    public function reverseGeoCodeLocation($location) {
        $cURL = curl_init();
        curl_setopt($cURL, CURLOPT_URL, 'http://maps.google.com/maps/geo?q='.$location.'&output=json');
        curl_setopt($cURL, CURLOPT_RETURNTRANSFER, 1);
        return $this->reverseGeoCodeJSON = curl_exec($cURL);
        curl_close ($cURL); 
    }

    public function getCoords($json_data) {

        $obj = json_decode($json_data, true);

        var_dump($obj);

        // I NEED THE COORDINATE VALUES HERE TO PLACE BELOW

        $this->latitude = '';
        $this->longitude = '';

    }

}

And this is the array I need to work from:
http://www.thebigfishexperience.org.uk/sources/ajax/venue-json.php?location=london

I need to retrieve the coordinate values from the array and place them into my instance variables as you see above.

  • 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-23T14:47:16+00:00Added an answer on May 23, 2026 at 2:47 pm

    i believe you need:

     $this->latitude = $obj['Placemark'][0]['Point']['coordinates'][0];
     $this->longitude = $obj['Placemark'][0]['Point']['coordinates'][1];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having some trouble getting log4net to work from ASP.NET 3.5. This is the
Having some trouble getting this query to work correctly. mysql_query(DELETE FROM `table` WHERE `id`
Having some trouble getting a JSON feed to load from my site. I'm starting
I'm having some trouble getting my Core Data entities to play nice and order
I'm having trouble getting a td to have some text at its top and
I'm having some trouble getting results from a c# OleDbCommand on an MS Access
I am having trouble getting a regex to work. This is the string. some
I'm having some trouble with Java's Calendar. I'm parsing some data from a txt
I'm getting data from an array. For some reason the array has key values
Im having some trouble getting on with my first codeigniter project, and i have

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.