Skip to content

Instantly share code, notes, and snippets.

@checco
Last active October 17, 2016 07:59
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 checco/868cf1f09202032d64191c87cdd0e709 to your computer and use it in GitHub Desktop.
Save checco/868cf1f09202032d64191c87cdd0e709 to your computer and use it in GitHub Desktop.
OTA_HotelDescriptiveInfoRQ 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_HotelDescriptiveInfoRQ 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/05 OTA_HotelSearchRQ.xsd" EchoToken="HL" Target="Test" Version="1.003" PrimaryLangID="en" MaxResponses="20"> <POS> <Source> <RequestorID ID="USER" MessagePassword="PASSWORD" /> </Source> </POS> <HotelDescriptiveInfos> <HotelDescriptiveInfo HotelCode="HOTELCODE"> <HotelInfo SendData="true" /> <FacilityInfo SendGuestRooms="true" /> <Policies SendPolicies="true" /> <ContactInfo SendData="true" /> <MultimediaObjects SendData="true" /> <ContentInfos> <ContentInfo Name="CustomerRatings" /> <ContentInfo Name="CustomerReviews" /> </ContentInfos> </HotelDescriptiveInfo> </HotelDescriptiveInfos> </OTA_HotelDescriptiveInfoRQ>'
response = http.request(request)
puts response.read_body
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment