title: Automated download from multiple URLs, handling Feedback Dialog / cookies
body: <p>I try to bulk download CORINE Landcover zip-files from <a href="http://www.eea.europa.eu/data-and-maps/data/clc-2006-vector-data-version-2" rel="nofollow">this site</a> but I think the interconnected feedback survey window from Google Analytics is making troubles here.. Is there some sort of Curl handler for these issues?</p>
  
  <p>I viewed the cookie in sqlite manager, these are the entries: baseDomain = "europa.eu", name = "clc06_c133.zip", value = "sectors%3Denvironment", host = "www.eea.europa.eu",..
  the cookie path is "C:\Users\Kay\AppData\Roaming\Mozilla\Firefox\Profiles\ckut8fjm.default\cookies.sqlite"</p>
  
  <pre><code>setwd("D:/GIS DataBase/CorineLC/")
  
  mylist &lt;- list(
  clc06_1 &lt;- "111 - Continuous urban fabric",
  clc06_2 &lt;- "112 - Discontinuous urban fabric",
  clc06_3 &lt;- "121 - Industrial or commercial units",
  clc06_4 &lt;- "122 - Road and rail networks and associated land",
  clc06_5 &lt;- "123 - Port areas",
  clc06_6 &lt;- "124 - Airports",
  clc06_7 &lt;- "131 - Mineral extraction sites",
  clc06_8 &lt;- "132 - Dump sites",
  clc06_9 &lt;- "133 - Construction sites",
  clc06_10 &lt;- "141 - Green urban areas",
  clc06_11 &lt;- "142 - Sport and leisure facilities",
  clc06_12 &lt;- "211 - Non-irrigated arable land",
  clc06_13 &lt;- "212 - Permanently irrigated land",
  clc06_14 &lt;- "213 - Rice fields",
  clc06_15 &lt;- "221 - Vineyards",
  clc06_16 &lt;- "222 - Fruit trees and berry plantations",
  clc06_17 &lt;- "223 - Olive groves",
  clc06_18 &lt;- "231 - Pastures",
  clc06_19 &lt;- "241 - Annual crops associated with permanent crops",
  clc06_20 &lt;- "242 - Complex cultivation patterns",
  clc06_21 &lt;- "243 - Land principally occupied by agriculture, with significant areas of natural vegetation",
  clc06_22 &lt;- "244 - Agro-forestry areas",
  clc06_23 &lt;- "311 - Broad-leaved forest",
  clc06_24 &lt;- "312 - Coniferous forest",
  clc06_25 &lt;- "313 - Mixed forest",
  clc06_26 &lt;- "321 - Natural grasslands",
  clc06_27 &lt;- "322 - Moors and heathland",
  clc06_28 &lt;- "323 - Sclerophyllous vegetation",
  clc06_29 &lt;- "324 - Transitional woodland-shrub",
  clc06_30 &lt;- "331 - Beaches, dunes, sands",
  clc06_31 &lt;- "332 - Bare rocks",
  clc06_32 &lt;- "333 - Sparsely vegetated areas",
  clc06_33 &lt;- "334 - Burnt areas",
  clc06_34 &lt;- "335 - Glaciers and perpetual snow",
  clc06_35 &lt;- "411 - Inland marshes",
  clc06_36 &lt;- "412 - Peat bogs",
  clc06_37 &lt;- "421 - Salt marshes",
  clc06_38 &lt;- "422 - Salines",
  clc06_39 &lt;- "423 - Intertidal flats",
  clc06_40 &lt;- "511 - Water courses",
  clc06_41 &lt;- "512 - Water bodies",
  clc06_42 &lt;- "521 - Coastal lagoons",
  clc06_43 &lt;- "522 - Estuaries",
  clc06_44 &lt;- "523 - Sea and ocean")
  
  # extract the CLC codes which are the 3-digit number in the string:
  foo1 &lt;- function(x) unlist(strsplit(x, " - "))[[1]]
  # and the names
  foo2 &lt;- function(x) unlist(strsplit(x, " - "))[[2]]
  
  codes &lt;- sapply(mylist, foo1, simplify = T)
  names &lt;- sapply(mylist, foo2, simplify = T)
  
  # make urls
  names_url &lt;- gsub(",", "",  gsub("\\s", "-", names))
  dl_url &lt;- paste0("http://www.eea.europa.eu/data-and-maps/data/clc-2006-vector-data-version-2/",
                   codes, "-", names_url, "/clc06_c", codes, ".zip/at_download/file")
  
  # get zip file names
  get_zip_name &lt;- function(x) unlist(strsplit(x, "/"))[grep(".zip", unlist(strsplit(x, "/")))]
  
  # function to plug into sapply
  dl_url_to_zip &lt;- function(x) download.file(x, dest = get_zip_name(x))
  
  # gives http status 404!
  sapply(dl_url, dl_url_to_zip)
  </code></pre>