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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T03:06:34+00:00 2026-05-21T03:06:34+00:00

I have a script that loops through many url based XML files to compare

  • 0

I have a script that loops through many url based XML files to compare values. There are currently over 50 separate XML files but this number will grow into the hundreds. The compare values are simple and retrieved from a string.

The XML files are well structured and small, 10-26KB, and I only grab 1-2 values from the url based API.

For example:

foreach(); //loop starts, left out details

$value1 = "some_number";

//load all the xml

$request_url = "example.com/file.xml";
$request_url = urlencode($request_url);
$response_xml = @simplexml_load_file($request_url);

$res =  $response_xml;  
$version = $res->version;

if ($value1 > $version)
echo "yay";

endforeach;  //end loop

Now the problem is this becomes slow as beans when getting more that 20 requests, I’d imagine with several hundred it slows to a crawl.

Is there a better method or faster way to do this?

  • 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-21T03:06:35+00:00Added an answer on May 21, 2026 at 3:06 am

    Since fetching the remote files is the slowest part of your iteration, it’s the first place to start to improve performance. I would use cURL to fetch all the files in one swap and after the remote sessions are done, process the data.
    cURL provides a curl_multi_exec. php.net/manual/en/function.curl-multi-exec.php which you can feed multiple curl-handles. This will re-use your connection if possible, you can run requests simultaneously.

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

Sidebar

Related Questions

I have a script that loops through a series of four (or less) characters
I have a bash shell script that loops through all child directories (but not
I have a PHP script that initialises an image gallery. It loops through all
I have a script that retrieves objects from a remote server through an Ajax
I have a do/while loop that goes over database rows. Because it runs many
I have a script that I'd like to continue using, but it looks like
I have a script that parses the filenames of TV episodes (show.name.s01e02.avi for example),
I have a script that checks responses from HTTP servers using the PEAR HTTP
I have a script that takes a table name and generates a control file
I have a script that renders graphs in gnuplot. The graphs all end up

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.