Skip to content

Instantly share code, notes, and snippets.

@jagmitg
Created October 23, 2011 09:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jagmitg/1307170 to your computer and use it in GitHub Desktop.
Save jagmitg/1307170 to your computer and use it in GitHub Desktop.
def create
@user = User.new(params[:user])
a = "https://www.example.com"
url = URI.parse(a)
http = Net::HTTP.new( url.host, url.port )
http.use_ssl = true if url.port == 443
http.verify_mode = OpenSSL::SSL::VERIFY_NONE if url.port == 443
path = url.path + "?" + "request_query"
res, data = http.get( path )
case res
when Net::HTTPSuccess, Net::HTTPRedirection
@doc = Nokogiri::XML(data)
@doc.xpath('/status/success').each do |oop|
@ee = oop.content
end
if @ee.nil?
@doc.xpath('/status/error').each do |link|
@status = link.content
end
flash[:notice] = @status
render "new"
else
flash[:notice] = @ee
redirect_to "/"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment