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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T03:44:41+00:00 2026-05-24T03:44:41+00:00

Why am I getting this error? Warning: file_get_contents(http://www.example.com) [function.file-get-contents]: failed to open stream: HTTP

  • 0

Why am I getting this error?

Warning: file_get_contents(http://www.example.com) [function.file-get-contents]: failed to open stream: HTTP request failed! in C:\xampp\htdocs\test.php on line 22

Fatal error: Maximum execution time of 30 seconds exceeded in C:\xampp\htdocs\test.php on line 22

Here is the code:

 try {
    $sgs = file_get_contents("http://www.example.com");
 }
 catch (Exception $e) {
    echo '123';
 }
 echo '467';

Aren’t try\catch supposed to continue the excecution of the code? Or maybe there is some different way to do it?

  • 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-24T03:44:42+00:00Added an answer on May 24, 2026 at 3:44 am

    try… catch is more for null object exceptions and manually thrown exceptions. It really isn’t the same paradigm as you might see in Java. Warnings are almost deceptive in the fact that they will specifically ignore try…catch blocks.

    To suppress a warning, prefix the method call (or array access) with an @.

     $a = array();
     $b = @$a[ 1 ]; // array key does not exist, but there is no error.
    
     $foo = @file_get_contents( "http://somewhere.com" );
     if( FALSE === $foo ){ 
         // you may want to read on === there;s a lot to cover here. 
         // read has failed.
     }
    

    Oh, and it is best to view Fatal Exceptions are also completely uncatchable. Some of them can be caught in some circumstances, but really, you want to fix fatal errors, you don’t want to handle them.

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

Sidebar

Related Questions

I'm getting the following error message: Warning: file_get_contents( http://localhost/sample_pie.php ) [function.file-get-contents]: failed to open
We've all seen this error before: Warning: require_once(test/blah.inc) [function.require-once]: failed to open stream: No
Getting this error: 2009-09-03 12:44:02.307 xcodebuild[307:10b] warning: compiler 'com.apple.compilers.llvm.clang.1_0.analyzer' is based on missing compiler
I'm getting this PHP warning in my error_log and want to get it fixed.
am getting this error when i open my site in internet explorer......... plz help
Getting this error with jquery & jquery.form. Site has been live for awhile..upgraded to
Anyone getting this error when using the new free chart controls MS bought from
I´m getting this error while trying to commit to a svn repository: svn: MKACTIVITY
Keep getting this error after inserting a subdatasheet into a query and trying to
I am getting this error now that I hit version number 1.256.0: Error 4

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.