From: Matthias Reitinger Date: 2009-07-20T10:00:05+09:00 Subject: Re: Problem with Flickr API and net/http Kyle Peyton wrote: > I'm writing an app that uses the flickr api via http requests. I can't > figure out if the problem I'm having is the way I'm implementing this > with net/http or simply a problem with the flickr api. My code looks > like this: > > xml_data = Net::HTTP.get_response(URI.parse(url)).body > Hpricot(xml_data) > > I know the url is valid, because I can paste the url directly in to my > browser and I get valid xml from flickr. But when I issue this code in > my app, I get a blank response. xml_data is an empty string every time > and I can't figure out why. Am I requesting a response incorrectly? > Anyone have any idea? Take a look at the HTTP response code (call .code instead of .body). If it is in the 3xx range the server is redirecting you to a different URI. A browser usually follows these redirects automatically. -Matthias