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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T02:56:39+00:00 2026-06-17T02:56:39+00:00

I call file1.php from android and I want it to send xml response to

  • 0

I call file1.php from android and I want it to send xml response to android and immediately after that call file2.php from file1.php. I also want to send an array from file1.php to file2.php. How can this be done without delaying sending the response to android as android needs response only from file1. But file2 input is file1’s output. So is there a way in which i can send file1’s xml output to android and then call file2 immediately after that?

Details :
Android :-> Display near by restaurants using google places api.

File1.php :-> Get the list of near by restaurants google places api and send it to android.
Immediately after this I want to call File2.php from File1.php where I send the reference id’s of the restaurants(o/p of File1) so that i can get each restaurants details.

Android Code:

ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
            nameValuePairs.add(new BasicNameValuePair("latitude",latt));
            nameValuePairs.add(new BasicNameValuePair("longitude", longi));

            DefaultHttpClient httpClient = new DefaultHttpClient();
            HttpPost httpPost = new HttpPost("http://www.xyz.com/file1.php");

            httpPost.setEntity(new UrlEncodedFormEntity      (nameValuePairs));

            HttpResponse httpResponse = httpClient.execute(httpPost);

            HttpEntity httpEntity = httpResponse.getEntity();
            line = EntityUtils.toString(httpEntity);

File1.php

 $url = 'https://maps.googleapis.com/maps/api/place/search/xml?....';
 //get xml response and send it to android

//call file2.php and send reference id's so as ot get each restaurant details

File2.php

for(each restaurant)
//get details and do some back end processing.

Main thing is android should receive response before file2 starts executing.

  • 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-17T02:56:40+00:00Added an answer on June 17, 2026 at 2:56 am

    You can’t execute an external php-file (that is actually make a new http-request) in parallel to existing request-response flow. There exist 2 possible solutions.

    1. You can implement a task queue on your server (usually a dedicated table in DB), so while processing a request by file1.php you should add new task in the queue. In parallel to main web-server process, you should have a php “daemon” always running, which looks for new tasks and processes them in background (fetches required details by file2.php). Once a task is ready (or a part of it, for example several first records with details are available), mark it appropriately in the queue. Android app should periodically check new details and load them using another access point (say file3.php), which returns available details from partially or completely executed task. I don’t know which server-side framework do you use (if any), but some of them provide “batch jobs” based on cron. This looks not as easy to go way though. Most appropriate method would be to use push notification, that is the server should notify your client about new available details for items in the list already sent to the client.

    2. You can move part of control logic into the Android app. This way it requests a list of objects, then in a loop send new requests for object details, which are proxied to Google Places by means of file2.php. In other words, file2.php is executed by client instead of the server.

    In addition, you should possibly look at some server-side tools other than php, for example Node.js, which is much better suited for implementing long polling and websockets (choose one of them).

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

Sidebar

Related Questions

I want to call specific php function on server from Android application and also
I want to call a PHP file that starts like <?php function connection ()
I want to call a .php file from the OnClick event. <input id=Edit name=Edit
I want to call a .php file and pass three arguments so that the
I want to call a PHP file using ajax where in that PHP i
I am trying to call ejabberdctl from a PHP file, but it is failing
I'm trying to call a function from a form within the same .php file,
I want to call a PHP file but want to pass an argument to
i've used .load() with jquery to call a php file that will return search
I'm using the following htaccess script so that I can hide index.php from the

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.