Redirected URL

Hi,
I was trying to parse a web page where multiple hyper links exist.
Each hyper link redirecting to a different server. I just want store
first server it is redirecting the request too.

I tried using ‘net/http’ to capture ‘Location’ from response. But not
working. Showing ‘Location’ value as blank.

Please help.
Thanks,
Anil.

Anil K. wrote:

Hi,
I was trying to parse a web page where multiple hyper links exist.
Each hyper link redirecting to a different server. I just want store
first server it is redirecting the request too.

I tried using ‘net/http’ to capture ‘Location’ from response. But not
working. Showing ‘Location’ value as blank.

Do you know the difference between:

  1. parsing a web page and retrieving the first link’s href

and

  1. examining a response’s Location header

http://en.wikipedia.org/wiki/URL_redirection

Thanks for you reply. I know the difference. I resolved this issue by
sending ‘User-Agent’ value in header.

Thanks,
Anil.

7stud – wrote:

Anil K. wrote:

Hi,
I was trying to parse a web page where multiple hyper links exist.
Each hyper link redirecting to a different server. I just want store
first server it is redirecting the request too.

I tried using ‘net/http’ to capture ‘Location’ from response. But not
working. Showing ‘Location’ value as blank.

Do you know the difference between:

  1. parsing a web page and retrieving the first link’s href

and

  1. examining a response’s Location header

http://en.wikipedia.org/wiki/URL_redirection

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs