Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I would like to check if url redirects to another page in R

Tags:

http

url

r

I need to check if the url redirects to another page in R. Is it possible ?

like image 610
Savi Avatar asked Feb 10 '14 15:02

Savi


1 Answers

Check out the httr package, and there the GET function:

> library(httr)
> names(GET("http://www.stackoverflow.com"))
[1] "url"         "handle"      "status_code" "headers"     "cookies"
[6] "content"     "times"       "config"     
> GET("http://www.stackoverflow.com")$status_code
[1] 200
like image 155
krlmlr Avatar answered Oct 04 '22 18:10

krlmlr