01-06-2009, 08:40 AM
Macro
out
str friendID="294756645"
str url.format("http://collect.myspace.com/index.cfm?fuseaction=bandprofile.listAllShows&friendid=%s" friendID)
HtmlDoc d.InitFromWeb(url)
str s=d.GetHtml
;out s
;d.GetForm(1 0 _s); out _s ;;debug
#compile CSqlite
str dbfile="$desktop$\Shows.db3"
str sql
CSqlite db1.Open(dbfile)
db1.Exec("CREATE TABLE IF NOT EXISTS Shows (Band,DateTime,Venue,Address,City,Zip_Code,State,Cost,Description)")
;to prevent adding duplicates, you could use eg Band UNIQUE above,
;but in your case this will not work because need to check several fields.
;Don't know how to do it.
ARRAY(POSTFIELD) a
int i
for i 1 1000000 ;;don't know how many forms
,d.GetForm(i 0 0 a); err break
,;out a[0].name
,if(a[0].name~"calEvtLocation"=0) break
,
,str sBand calEvtDateTime calEvtLocation calEvtStreet calEvtCity calEvtZip calEvtState sCost sDescription
,sBand=a[1].value
,calEvtDateTime=a[6].value
,;...
,
,sql.format("INSERT INTO Shows VALUES ('%s','%s','%s','%s','%s','%s','%s','%s','%s')" sBand calEvtDateTime calEvtLocation calEvtStreet calEvtCity calEvtZip calEvtState sCost sDescription)
,db1.Exec(sql)
,;err continue;;eg error if duplicate if Band UNIQUE used