Retrieve Twitter Status using PHP and XML


/ Published in: PHP
Save to your folder(s)

This is the beginning of my retrieval of twitter status class...just something im playing with right now. It retrieves the xml, saves it on your server, then you can either use javascript or php to traverse the xml tree.


Copy this code and paste it in your HTML
  1. <?php
  2.  
  3. class xmlmanager{
  4.  
  5. private $twitterXML;
  6. private $twitterURL = ""; //insert xml url here
  7. private $dom;
  8.  
  9. function __construct(){
  10.  
  11. }
  12.  
  13. function GetTwitterXML(){
  14.  
  15. $this->twitterXML = simplexml_load_file($this->twitterURL);
  16.  
  17. return ;
  18.  
  19. }
  20.  
  21. function save_twitter_xml_as_file(){
  22. $this->dom = new DOMDocument();
  23. $this->dom->loadXML($this->twitterXML->asXML());
  24. $this->dom->saveXML();
  25. $this->dom->save('mytwitter.xml');
  26. return ;
  27. }
  28.  
  29. function __destruct(){
  30.  
  31. }
  32. }
  33.  
  34. ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.