Skip to content

Instantly share code, notes, and snippets.

@checco
Last active October 17, 2016 08:01
Show Gist options
  • Save checco/92d7433a7178a93d908c6e71ea4dbe25 to your computer and use it in GitHub Desktop.
Save checco/92d7433a7178a93d908c6e71ea4dbe25 to your computer and use it in GitHub Desktop.
OTA_PingRQ with class NET:Http
require 'uri'
require 'openssl'
require 'net/http'
url = URI("https://www.hostelspoint.com/xml/xml.php")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/x-www-form-urlencoded'
request["cache-control"] = 'no-cache'
request.body = 'OTA_request=<?xml version="1.0" encoding="UTF-8"?><OTA_PingRQ xmlns="http://www.opentravel.org/OTA/2003/05" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opentravel.org/OTA/2003/05OTA_PingRQ.xsd" TimeStamp="2003-03-17T11:09:47-05:00" Target="Production" Version="1.001" PrimaryLangID="en" EchoToken="TEXT4TOKEN"> <EchoData>SOMETHINGrightHERE</EchoData> </OTA_PingRQ>'
response = http.request(request)
puts response.read_body
@checco
Copy link
Author

checco commented Oct 13, 2016

Launch this script with: ruby ping.rb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment