Skip to content

Instantly share code, notes, and snippets.

@havenwood
Last active May 19, 2019 14:06
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 havenwood/1d1ed51408b6fd8aa0048a21a8728fd5 to your computer and use it in GitHub Desktop.
Save havenwood/1d1ed51408b6fd8aa0048a21a8728fd5 to your computer and use it in GitHub Desktop.
# frozen_string_literal: true
require 'net/http'
require 'uri'
params = {'jcd' => '0',
'dtd' => url_date,
'place' => bench_char,
'sbdb' => bench_num,
'dw' => type_num,
'mfb' => type_char,
'lt' => '0',
'code' => '',
'a' => '0.0912928832004298',
'csrf_token' => '728ae5adc4336afac52b5b500d3f449573b0d325'}.freeze
uri = URI.parse 'https://mphc.gov.in/php/hc/causelist/get_cl.php'
uri.query = URI.encode_www_form params
request = Net::HTTP::Post.new uri
request['Origin'] = 'https://mphc.gov.in'
request['Accept-Language'] = 'en-US,en;q=0.9,la;q=0.8'
request['User-Agent'] = 'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.62 Mobile Safari/537.36'
request['Accept'] = '*/*'
request['Referer'] = 'https://mphc.gov.in/causelist'
request['Cookie'] = 'SSESS8c45314aadff2a84e50fe1a5f9b552c7=vf1oh5jQBkid-AEwP2DJO1AmWcGo1LBy366MlrKyqys; has_js=1'
request['Connection'] = 'keep-alive'
request['Content-Length'] = '0'
req_options = {use_ssl: uri.scheme == 'https'}
response = Net::HTTP.start uri.hostname, uri.port, req_options do |http|
http.request request
end
p response.code
p response.body
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment