def getAdByPage
@@userId=request.env['HTTP_USERID']
if (@@userId.nil?)
@@userId="101"
end
adArgs= SequencedHash.new
adArgs["ad_type"]="text"
adArgs["channel"]="8618723264"
adArgs["client"]="pub-0061196910475770"
adArgs["format"]="mobile_single"
adArgs["host"]=request.host
adArgs["ip"]=request.remote_ip
adArgs["markup"]="xhtml"
adArgs["output"]="xhtml"
adArgs["oe"]="utf8"
adArgs["ref"]=request.referer
adArgs["url"]="http://"+request.env["HTTP_HOST"]+request.env["REQUEST_URI"]
adArgs["eip"]=Digest::SHA1.hexdigest(@@userId)[0..20]
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
@pagead=open(adURL).read
end