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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:39:53+00:00 2026-06-05T20:39:53+00:00

I am accessing an XML API (flight search comparison) via a PHP Proxy like

  • 0

I am accessing an XML API (flight search comparison) via a PHP Proxy like here.

The API always has a full file for download. The first version states there are 0 results, then after calling it a few times the first results pop up.

API documentation says:

the result method will always give you the current state of the
searchresult. You may call it multiple times (maybe with ajax calls)

My problem is, I don’t know when it’s done, i.e. when all results are delivered.

I tried this:

  1. read till feof, then reset the file position indicator via fseek() and wait a little like here but that doesn’t work, as the stream is not supporting fseek().

  2. waiting a few seconds and then displaying the results, but that doesn’t work well as the API sometimes needs very long (and I am not getting everything)

  3. read till feof, then using ftell() to see whether new stuff has been written to the file, but I am lacking the possibility to do something afterwards …

    $handle = fopen($flights_url, "r");
    if ($handle) {
        while (!feof($handle)) {
            $buffer = fgets($handle);
            echo $buffer;
        }
        fclose($handle);
    }
    

I am out of ideas now. How should this be done in a nice way?

-T

Edit: changed formatting and added some code

  • 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-05T20:39:55+00:00Added an answer on June 5, 2026 at 8:39 pm

    Okay, I contacted one of the API’s developers.

    He told me, that they don’t send a ready-signal, because they also don’t know, when the response is finished. This is because they work with so many other APIs (it’s a comparison API, after all).

    The advice/solution he gave me, and which they use, is to poll a few times, with a few seconds delay between each poll, and then just take what’s there and leave the rest.

    Seems rather pragmatic than elegant to me, but that’s how they do it 🙂 Thanks to all who tried to give input!

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

Sidebar

Related Questions

XML element I am accessing: is here, if below sample is unreadable: http://api.petfinder.com/pet.find?&animal=dog&count=150&location=90605&key=a94884c2349b5b6975ec84fb51ac3ec4 <pets>
In this php script which reads an XML file, the inner loop for accessing
I tried accessing web for xml parsing using the code below: System.Uri proxy =
I'm accessing http://graphical.weather.gov/xml/SOAP_server/ndfdXMLserver.php using code generated by http://sudzc.com The SOAP message is being sent
Basically I have an XML file that looks like this: <?xml version=1.0 encoding=UTF-8?> <data>
I am accessing the gData Api on YouTube. I'll use this xml for reference.
I'm using PHP and CURL to get XML, but I'm having problems accessing a
I am reading an xml file using php, after reading those files i am
I have a php script which processes xml returned from an api call. What
I have a PHP script which fetches data from Salesforce via the Salesforce API

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.