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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:19:32+00:00 2026-05-27T07:19:32+00:00

Worked with XML feeds before, but this one seems to be causing an error.

  • 0

Worked with XML feeds before, but this one seems to be causing an error.

I am not experienced so please be gentle.

The following code should load in a Twitter feed using its XML address. And it does 20% of the time. The other times it returns in error. I have no idea why.

<?php 
   if(simplexml_load_file('https://api.twitter.com/1/statuses/user_timeline/quitecheesedoff.xml?count=6')) {
      $xml = simplexml_load_file('https://api.twitter.com/1/statuses/user_timeline/quitecheesedoff.xml?count=6');
      $tweets = $xml->xpath("/statuses/status");

      foreach($tweets as $tweet) {
         $text = $tweet->text;
         $date = $tweet->created_at;
         echo '<div class="tweet"><b>' . $text . '</b>' . $date . '</div>';
      }
   }
   else echo 'error';
?>

Error

Warning:
simplexml_load_file(https://api.twitter.com/1/statuses/user_timeline/quitecheesedoff.xml?count=6)
[function.simplexml-load-file]: failed to open stream: HTTP request
failed! HTTP/1.0 400 Bad Request in

  • 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-27T07:19:33+00:00Added an answer on May 27, 2026 at 7:19 am

    You’re probably making too many requests, triggering the hourly request limit of 150 – which becomes 75 with your code.

    I’d recommend using

    if (($xml = simplexml_load_file('...')) !== FALSE) {
    

    instead. Your $xml = ... line is then not required anymore.

    Update:

    The 400 error isn’t always actually used for bad requests at Twitter. Since it works 20% of the time I’d say it’s safe to say there’s something else.

    • Avoid XML unless your programming language doesn’t accept JSON (PHP does so use JSON!)
    • Avoid using non-recommended URLs. Use https://api.twitter.com/1/statuses/user_timeline.xml?count=6&screen_name=quitecheesedoff instead.

    In the past the 400 error was also given when Twitter’s internal proxies made mistakes.

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

Sidebar

Related Questions

i havent really worked with xml before, but i was wondering how could turn
I have not worked with XML much so this may be a basic question
I have not worked with XML in the database before so I need some
I have used the XML Parser before, and even though it worked OK, I
i have not worked with XML in a while can someone post the syntax
I have worked with Django for a while but I am new to xml-rpc.
I have the following mapping in my Castle Windsor xml file which has worked
Greetings, I'm no XSL/XSLT/XML shark, I have worked with some, though, but I've never
I tried parsing this huge XML document using XML minidom . While it worked
I'm doing a personal organizer for learning purposes, and i've never worked with XML

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.