def getAd(keywords)
logger.info "Smaato ad retrieval"
??
@@userId=request.env['HTTP_USERID']
if (@@userId.nil?)
@@userId="101"
end
adArgs= SequencedHash.new
adArgs["pub"]="3517"
adArgs["adspace"]="137"
adArgs["format"]="JPG"
adArgs["numads"]="1"
adArgs["offline"]="true"
adArgs["width"]="176"
adArgs["height"]="208"
adArgs["response"]="XML"
adArgs["user"]=@@userId
if (keywords)
adArgs["kws"]=CGI::escape(keywords)
end
adURL=@@adServer + "?"
first=1
adArgs.each_key do |x|
if adArgs[x]
(adURL=adURL+"&") unless first
first=nil
adURL = adURL + x + "=" + adArgs[x]
end
end
??
@adxml=open(adURL).read
??
if (@adxml)
adDoc = REXML::Document.new @adxml
@adelement = adDoc.elements["//ad"]
if (@adelement)
@adurl=@adelement.elements["link"].text
@urltext=@adelement.elements["adtext"].text
@urltext||="LINK TO AD"
end
end
end