I'm trying to pull a facebook avatar via auth. Here's what i'm doing:

```
def image_uri
  require 'net/http'
  image = URI.parse(params[:image]) # https://graph.facebook.com/565515262/picture
  fetch = Net::HTTP.get_response(image)
  based = 'data:image/jpg;base64,' << Base64.encode64(fetch)
  render :text => based
end

```

I'm getting the following error (new error — edited):

```
Connection reset by peer

```

I've tried googling about, I can't seem to get a solution, any ideas?

**I'm basically looking for the exact functioning of PHP's `file_get_contents()`**