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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:20:37+00:00 2026-05-27T14:20:37+00:00

We are currently performing searches on a Database and returning results in JSON format

  • 0

We are currently performing searches on a Database and returning results in JSON format to use on a Google Maps. The file that we call is named getvenues.php and works great on the server. It accepts a number of parameters and returns the results based on the query.

We then have a separate file that checks to see if there’s a JSON file on the server which contains the results, matches its age against a setting, and then returns the data either from the cache file, or builds a new cache file if it’s too old.

Since there are several thousand possible search options, we only cache single searches (either on a County, Region or Type). The JavaScript always calls our search_cache_builder.php file. If there is more than one search parameter, the file simply gets the contents returned by getvenues.php and serves it up without any caching.

Everything works great except for one particular combination. If a search is run for venue_type=Castle / Fort and venue_name=Leeds Castle, the search_cache_builder.php returns an empty array, even though accessing getvenues.php directly returns the required data.

Here’s a sample of the getvenues.php working with this data > http://dev.weddingvenues.com/lincweb/getvenues.php?type=Castle%20/%20Fort&venue_name=Leeds%20Castle

And here’s what the search_cache_builder.php script returns with an identical search (the address we are sending to is correct) > http://www.weddingvenues.com/search_cache_builder.php?type=castle%20/%20fort&venue_name=Leeds%20Castle

Here’s the code for the search_cache_builder.php file, which relates to this particular query:

$get_string = '?';
foreach($_GET as $key => $value)
{
    if($get_string === '?')
    {
        $get_string .= $key . '=' . $value;
    }
    else
    {
        $get_string .= '&' . $key . '=' . $value;
    }
}

//$get_string = str_replace(' ', '', $get_string);

// Otherwise, we need to serve up the page as is:
$file_url = GET_VEN_URL . $get_string;
echo file_get_contents($file_url);

Can anyone offer an explanation as to why the search_cache_builder.php file is returning an empty array?

  • 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-27T14:20:38+00:00Added an answer on May 27, 2026 at 2:20 pm

    You should urlencode() your parameter values.

    In fact, while your getvenues.php receives parameters directly from a browser it behaves OK, ’cause they are correctly urlencoded.

    I tried what follows in my computer towards your service and it works:

    define ("GET_VEN_URL", "http://www.weddingvenues.com/getvenues.php");
    
    $get_string = '?';
    foreach($_GET as $key => $value)
    {
        if($get_string === '?')
        {
            $get_string .= $key . '=' . urlencode($value);
        }
        else
        {
            $get_string .= '&' . $key . '=' . urlencode($value);
        }
    }
    
    
    $file_url = GET_VEN_URL . $get_string;
    echo "<pre>";
    echo $file_url;
    echo "<pre>";
    
    echo file_get_contents($file_url);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am performing some simulations in python that generates 1000 results. Each result has
I have several websites hosted on a VPS and am currently performing database backups
Currently we have a hybrid ASP/PHP setup connecting to a SQL Server 2005 database.
Currently I know of only two ways to cache data (I use PHP but
Currently, I am developing a product that does fairly intensive calculations using MS SQL
I'm currently looking for a way to search a big database (500MB - 10GB
I've a really poorly performing piece of regex, currently it makes Firefox, Chrome and
Currently, I wish to know which properties file is being loaded in my application.
I want to show the user detailed progress information when performing potentially lengthy database
I have a web application that stores a lot of user generated files. Currently

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.