I am trying to make a GET request to the below listed url which should
return an XML. When I put the compete url in my browser, I get the
intended XML.
http://axml.travelnow.com/external/xmlinterface.jsp?cid=1&resType=air&intfc=ws&xml=MCI</
originCityCode>ATL</
destinationCityCode>11/19/2005 11:00 AM</
departureDateTime>11/21/2005 10:00 AM</
returnDateTime>YR</
tripType> 1</
Passengers>
However, when I try to make a request with Net:HTTP I get a
HTTPNotValidError.
Here is what I have:
url = URI.parse(‘http://axml.travelnow.com’)
req = Net::HTTP::Get.new(“/external/xmlinterface.jsp?
cid=1&resType=air&intfc=ws&xml=MCI</
originCityCode>ATL</
destinationCityCode>11/19/2005 11:00 AM</
departureDateTime>11/21/2005 10:00 AM</
returnDateTime>YR</
tripType> 1</
Passengers></AirSessionRequest”)
res = Net::HTTP.start(url.host, url.port) {|http|
http.request(req)
}
puts res
puts res.body