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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:57:20+00:00 2026-05-26T16:57:20+00:00

When calling an external API with simplexml_load_file a server timeout or similar will generate

  • 0

When calling an external API with simplexml_load_file a server timeout or similar will generate warnings. Using file_exists on e.g. http://www.api.com?query=xyz does not work. Is there any built in function or appropriate solution for a simple check before performing the simplexml_load_file?

  • 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-26T16:57:20+00:00Added an answer on May 26, 2026 at 4:57 pm

    You can use file_get_contents, which you can check if it was successful based on its return values (false on failure, data on success). You can also use @ like so to suppress any warnings:

    if( $data = @file_get_contents( $filename)) ...
    

    Finally, use simplexml_load_string instead of simplexml_load_file using the data that file_get_contents returned to create your SimpleXMLElement object.

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

Sidebar

Related Questions

A blog post - http://petewarden.typepad.com/searchbrowser/2011/05/using-hadoop-with-external-api-calls.html - suggests calling external systems (querying the twitter API,
Calling the ajax called URL works well without ajax eg. http://localhost/ci/controller/method/param_value . But using
I want to make some API calls to a server using HttpURLConnection . But
I am using an external API to interface to a FireWire Camera. The API
I'm using a cross-domain Ajax request to an external API. Every so often it
I am calling an external REST service (Vimeo REST API). The response of the
I'm running Matlab 7.8.0 under Windows. I am calling an external utility using dos()
My project makes various calls to external API's using Python's urllib2.urlopen . I'm using
I'm calling an external HTTPS webservice. In order to check what is wrong, the
I am calling 5 external servers to retrieve XML-based data for each request for

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.