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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T06:25:31+00:00 2026-05-14T06:25:31+00:00

I am trying to get twitter updates like this: try { $doc = new

  • 0

I am trying to get twitter updates like this:

try {

  $doc = new DOMDocument();
  $doc->load('http://twitter.com/statuses/user_timeline/1234567890.rss');
  $isOK = true;

} catch( Zend_Exception $e ) {
  $isOK = false;
}

If there is not problem with internet connection then $isOK = true; is set. But if there is a problem in loading twitter page then it shows following warnings and does not set $isOK = false;

Warning: DOMDocument::load(http://twitter.com/statuses/user_timeline/1234567890.rss) [domdocument.load]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /var/www/vcred/application/controllers/IndexController.php on line 120

I don’t want to see above warning on my webpage in any case. Any idea?

Thanks

  • 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-14T06:25:31+00:00Added an answer on May 14, 2026 at 6:25 am

    Several options:

    Suppress all errors for just this function call

    @$doc->load('http://twitter.com/statuses/user_timeline/1234567890.rss');
    

    which is the same as

    $oldLevel = error_reporting(0);
    $doc->load('http://twitter.com/statuses/user_timeline/1234567890.rss');
    error_reporting($oldLevel);
    

    Suppressing errors this way is generally frowned upon, as it makes code harder to debug. Like Shrapnel pointed out, you want to disable public display of all error messages on a production system anyway. On Dev systems you are encouraged to use error_reporting(-1);, which would enable E_ALL and E_STRICT.

    If you want to use try/catch, you can also change default error handling and convert all errors to exceptions by doing

    function myErrorHandler($errno, $errstr, $errfile, $errline) {
        throw new Exception($errstr, $errno);
    }
    set_error_handler("myErrorHandler");
    

    This is a global change though and affects everything raised. You’d also have to use catch(Exception $e) instead of Zend_Exception then in your code, but it would work. Note that the above would convert everything, even Notices, so you will also get an Exception about $isOk being undefined if you are trying to access this later. Feel free to adapt the handler to your liking and check out the user comments for set_error_handler for more refined versions.

    Another global change would be to change the application.ini in your application folder, e.g. letting Zend Framework control error handling:

    phpSettings.display_startup_errors = 1
    phpSettings.display_errors = 1
    

    Change these to your needs. They are the same as in PHP.ini, e.g.

    display_errors:

    This determines whether errors should be printed to the screen as part of the output or if they should be hidden from the user.

    display_startup_errors:

    Even when display_errors is on, errors that occur during PHP’s startup sequence are not displayed. It’s strongly recommended to keep display_startup_errors off, except for debugging.

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

Sidebar

Related Questions

So in PHP, this code works live, done months ago. $tweetsToSlippy = $connection->get('http://search.twitter.com/search.json', array('q'
Hi I keep getting this error, I'm trying to get tweets from twitter via
In trying to implement the Twitter code at http://www.voiceoftech.com/swhitley/?p=681 I am getting a compile
I'm trying to get twitter bootstrap's .popover working within a .submit jquery event but
I have been trying to get Twitter Bootstrap btn-group with dropdown to work for
I'm trying to get the Twitter username from a contact in the address book
Im trying to follow a tutorial that is using SBJsonParser to get twitter feeds,
I'm trying to get a list of users who have authorized my Twitter application.
I am trying to use Twitter Bootstrap for GWT and get the same nice
I'm trying to get twitter update_profile_image to work using OAuth. I was using curl

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.