Posted By

alvincrespo on 02/20/10


Tagged

php xml status twitter


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

redstorm
luman


Retrieve Twitter Status using PHP and XML


 / Published in: PHP
 

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.

  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  

You need to login to post a comment.