lib/deepsecurity/screenscraping.rb
# Fetch the given +action+ with +parameters+. Post the result with settings changed according to +settings+
Fetch the given +action+ with +parameters+. Post the result with settings changed according to +settings+
Fetch the given + action + with + parameters + . Post the result with settings changed according to + settings +
def post_setting(action, parameters, settings)
      parameters_string = URI.escape(parameters.map { |key, value| "#{key}=#{value}" }.join("&"))
      path = "/#{action}?#{parameters_string}"
      body = send_authenticated_http_get(path)
      doc = Hpricot(body)
      form_values = {}
      doc.search("input").each do |input|
        type = input["type"]
        unless type == "button" || type == "submit"
          form_values[input['name']] = input['value'] unless input['name'].blank?
        end
      end
      form_values = form_values.merge(settings)
      action = doc.search("form#mainForm").first["action"]
      parameters_string = URI.encode_www_form(form_values)
      path = "/#{action}"
      send_authenticated_http_post(path, parameters_string)
    end
def post_setting ( action , parameters , settings ) parameters_string = URI . escape ( parameters . map { | key , value | "#{key}=#{value}" } . join ( "&" ) ) path = "/#{action}?#{parameters_string}" body = send_authenticated_http_get ( path ) doc = Hpricot ( body ) form_values = { } doc . search ( "input" ) . each do | input | type = input [ "type" ] unless type == "button" || type == "submit" form_values [ input [ 'name' ] ] = input [ 'value' ] unless input [ 'name' ] . blank? end end form_values = form_values . merge ( settings ) action = doc . search ( "form#mainForm" ) . first [ "action" ] parameters_string = URI . encode_www_form ( form_values ) path = "/#{action}" send_authenticated_http_post ( path , parameters_string ) end
Fetch the given +action+ with +parameters+.
Fetch the given + action + with + parameters + .
action
<not_specific>
parameters
<not_specific>
settings
<not_specific>