| 
    
     | 
       
        | Author |  |  
        | theowl Groupie
 
  
  
 Joined: February 24 2006
 Location: United States
 Online Status: Offline
 Posts: 59
 | 
          I got a simple RSS parse working using ph_regex
           | Posted: June 13 2006 at 20:07 | IP Logged |   |  
           | 
 |    
 insert into macroheader values ('RSS-GET','GRAB AND PARSE RSS FEEDS',0,0,1);
 insert into macrodetail values ('RSS-GET',2,15,'[GLOBAL1] ',NULL,'ph_geturl("http://blog.washingtonpost.com/securityfi x/index.xml")',0,'');
 insert into macrodetail values ('RSS-GET',3,15,'[GLOBAL1]',NULL,'ph_replaceallregex ("&....;","----", ph_getvar_s(3,1),2)',0,'');
 insert into macrodetail values ('RSS-GET',4,15,'[LOCAL2]',NULL,'ph_regexdiff ( "<title>", "</title>", ph_getvar_s(3,1),1,2) ',0,'');
 insert into macrodetail values ('RSS-GET',5,9,'',NULL,'"Site: [LOCAL2]"',0,'');
 insert into macrodetail values ('RSS-GET',6,15,'[LOCAL3]',NULL,'ph_regexdiff ( "<item>~255<item>", "</item>~255</item>", ph_getvar_s(3,1),1,2) ',0,'');
 insert into macrodetail values ('RSS-GET',7,15,'[LOCAL4]',NULL,'ph_regexdiff ( "<title>", "</title>", ph_getvar_s(1,3),1,2) ',0,'');
 insert into macrodetail values ('RSS-GET',8,15,'[LOCAL5]',NULL,'ph_regexdiff ( "<Description>", "</Description>", ph_getvar_s(1,3),1,2)',0,'');
 insert into macrodetail values ('RSS-GET',9,15,'[LOCAL5]',NULL,'ph_replaceallregex ( "\&+\;", "", ph_getvar_s(1,5),2)',0,'');
 insert into macrodetail values ('RSS-GET',10,16,'',NULL,'if(ph_getvar_s(2,1) = "",999,1)',1,'');
 insert into macrodetail values ('RSS-GET',11,9,'',NULL,'"Title: [LOCAL4]"',0,'');
 insert into macrodetail values ('RSS-GET',12,9,'',NULL,'"Description: [LOCAL5]"',0,'');
 insert into macrodetail values ('RSS-GET',13,16,'',NULL,'-5',1,'');
 
 I used [GLOBAL1] so the page would stay stored while I tested the ph_replaceallregex function. The issue I'm having is getting the regex to match more than one <item> on the page. Using <item>, it will match the first one, and if I use <item>~255<item> it will match the second. Do I really have to keep doing the 255 routine to go further down the page or does this function store the last search position somewhere so I can start from where it left off?
 
 Anyone?
 
 |  
        | Back to Top |     |  
        |  |  
        | TonyNo Moderator Group
 
  
  
 Joined: December 05 2001
 Location: United States
 Online Status: Offline
 Posts: 2889
 | 
          Take a look at my Weather Warnings macro for how to do this. It also parses <item> tags.
           | Posted: June 13 2006 at 20:29 | IP Logged |   |  
           | 
 |  
 |  
        | Back to Top |       |  
        |  |  
        | theowl Groupie
 
  
  
 Joined: February 24 2006
 Location: United States
 Online Status: Offline
 Posts: 59
 | 
          Tony,
           | Posted: June 15 2006 at 14:58 | IP Logged |   |  
           | 
 |  
 I imported that and it worked great. However, it's above my PH knowledge. From what I can decode, it looks like your doing a multi-search...but that's as far as I could factor.
 
 I did find an activeX helper that gives VBscript the ability to handle all versions of RSS (I hope). I'm working on a little script using that.
 
 So far, I can just feed the script a URL, channel to access, and item I want. Once I get the error checking correct and make the PH modification... PH should be able to easily handle everything else.
 
 |  
        | Back to Top |     |  
        |  |  
        | dhoward Admin Group
 
  
  
 Joined: June 29 2001
 Location: United States
 Online Status: Offline
 Posts: 4447
 | 
          Owl,
           | Posted: June 16 2006 at 14:37 | IP Logged |   |  
           | 
 |  
 Keep us posted on your progress.  We don't have too many people exercising the VBScript capabilities of PowerHome so would love to see what you're doing.
 
 Also, the next beta will include some additional regex functions to hopefully make searches easier.
 
 Dave.
 
 |  
        | Back to Top |       |  
        |  |  
        | theowl Groupie
 
  
  
 Joined: February 24 2006
 Location: United States
 Online Status: Offline
 Posts: 59
 | 
          Will do
           | Posted: June 17 2006 at 15:30 | IP Logged |   |  
           | 
 |  
 Most of the script is just error checking stuff, the actual action code is quite small.
 
 It's nice to have the VBscript ability in PH because I can write and debug those type of scripts at work if I'm bored. Then e-mail them to the automation system, drop in place, and away it goes.
 |  
        | Back to Top |     |  
        |  |  |  |