来自Twitter的PHP XML Feed使用情况

The following code should take the xml feed from Twitter and echo the results.

<?php

$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>' . $text . '</div>' . '<b>' . $date . '</b>';
}

?>

Instead it returns this.

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 /home/divethe1/public_html/robin-knight.com/wp-content/themes/RIKsoft/index.php on line 142

You might try using DOMDocument->load( $url ). The URL for the Twitter feed is also available without SSL, try that if SSL gives you grief and you don't need the secure version.