# # Copyright (C) 2007 Mobio Networks, Inc. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # =begin this provides advertising fetch for m_khoj =end require 'uri' require 'open-uri' module Rmobio module Ads module MKhoj def getAd(keywords,adClient,ip=request.remote_ip,url=request.request_uri,useragent=request.user_agent) getAdByPage(adClient,ip,url,useragent) # keywords have no effect in mKhoj end def getAdByPage(adClient,ip=request.remote_ip,url=request.request_uri,useragent=request.user_agent) # mKhoj just detects your URL, so you don't really need an adClient variable for this particular network! #carrier="59.181.113.59" # only works with India carriers!! adUrl = "http://www.mkhoj.com/view/Traffic/ShowAd.aspx?siteId=330ed28f-0de9-4c4f-b0a8-1f2118358c80&handset="+URI.escape(useragent)+"&carrier="+ip #adUrl="http://www.mkhoj.com/view/Traffic/ShowAd.aspx?siteId=330ed28f-0de9-4c4f-b0a8-1f2118358c80&handset=nokia6030/&carrier=59.181.113.59" logger.info "Calling: " + adUrl begin @ad = open(adUrl).read logger.info "Returned ad: " + @ad rescue end @ad end end end end