clankill3r Posted May 22, 2011 Share Posted May 22, 2011 I want to gettwitter feeds, this gives me a xml http://twitter.com/statuses/user_timeline.rss?screen_name=fleuragemapvv&count=3 based on this: http://www.w3schools.com/PHP/php_xml_simplexml.asp i try to get the xml with: <?php $xml = simplexml_load_file("http://twitter.com/statuses/user_timeline.rss?screen_name=fleuragemapvv&count=3"); ?> i get this error: Warning: simplexml_load_file(http://twitter.com/statuses/user_timeline.rss?screen_name=fleuragemapvv&count=3): failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request in /home/vhosting/x/vhost0033377/domains/doekewartena.nl/htdocs/www/temp/twitter03.php on line 2 Warning: simplexml_load_file(): I/O warning : failed to load external entity "http://twitter.com/statuses/user_timeline.rss?screen_name=fleuragemapvv&count=3" in /home/vhosting/x/vhost0033377/domains/doekewartena.nl/htdocs/www/temp/twitter03.php on line 2 i have no clue, i'm very new to php can i even use simplexml_load_file cause it has no .xml file type extention. Quote Link to comment https://forums.phpfreaks.com/topic/237124-getting-xml-problems/ Share on other sites More sharing options...
silkfire Posted May 22, 2011 Share Posted May 22, 2011 Fetch the RSS with cURL then load the string with simplexml_load_string. Quote Link to comment https://forums.phpfreaks.com/topic/237124-getting-xml-problems/#findComment-1218772 Share on other sites More sharing options...
clankill3r Posted May 29, 2011 Author Share Posted May 29, 2011 thanks, unfortionally i have to use the twitter api, else i always get the error that i exeeded my limit of 150 per hour... i hate the twitter api documentation Quote Link to comment https://forums.phpfreaks.com/topic/237124-getting-xml-problems/#findComment-1221965 Share on other sites More sharing options...
harristweed Posted May 29, 2011 Share Posted May 29, 2011 I can connect? <?php $xml_feed="http://twitter.com/statuses/user_timeline.rss?screen_name=fleuragemapvv&count=3"; if($xml = simplexml_load_file("$xml_feed")){ echo"connected"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/237124-getting-xml-problems/#findComment-1221967 Share on other sites More sharing options...
xyph Posted May 29, 2011 Share Posted May 29, 2011 Could possibly be your server limitations on loading external files. The above script worked fine for me as well. Quote Link to comment https://forums.phpfreaks.com/topic/237124-getting-xml-problems/#findComment-1221968 Share on other sites More sharing options...
clankill3r Posted May 29, 2011 Author Share Posted May 29, 2011 It can be that your xml only containts the error message. For the rest, my server is somwhere hosted with douzends of other sites where probably others do twitter requests aswell. So that's why i always hit the 150 limit. Quote Link to comment https://forums.phpfreaks.com/topic/237124-getting-xml-problems/#findComment-1221971 Share on other sites More sharing options...
xyph Posted May 29, 2011 Share Posted May 29, 2011 Okay, but what you aren't understanding is the above code example works fine on OUR servers. That means the issue is with a SERVER, not with your code. Quote Link to comment https://forums.phpfreaks.com/topic/237124-getting-xml-problems/#findComment-1221975 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.