If I copy and paste the urls below into Chrome I get a json response, but using the httr::GET function results in a 502 from the server. Can anyone explain to me what is going on?
Update:a confirmation that you get a response in the browser and not with the httr GET request will also be helpful
library(httr)
url1 <- 'http://data.stats.gov.cn/english/easyquery.htm?m=QueryData&dbcode=fsnd&rowcode=reg&colcode=sj&wds=[{"wdcode":"zb","valuecode":"A090201"}]&dfwds=[{"wdcode":"sj","valuecode":"1995-2014"}]&k1=1472740901192'
url2 <- 'http://data.stats.gov.cn/english/easyquery.htm?m=QueryData&dbcode=fsnd&rowcode=reg&colcode=sj&wds=[{%22wdcode%22:%22zb%22,%22valuecode%22:%22A090201%22}]&dfwds=[{%22wdcode%22:%22sj%22,%22valuecode%22:%221995-2014%22}]&k1=1472740901192'
res <- httr::GET(url1)
res
#> Response [http://data.stats.gov.cn/english/easyquery.htm?m=QueryData&dbcode=fsnd&rowcode=reg&colcode=sj&wds=[{"wdcode":"zb","valuecode":"A090201"}]&dfwds=[{"wdcode":"sj","valuecode":"1995-2014"}]&k1=1472740901192]
#> Date: 2019-06-30 11:02
#> Status: 502
#> Content-Type: <unknown>
#> Size: 281 B
#> <BINARY BODY>
res <- httr::GET(url1, httr::add_headers("User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36"))
res
#> Response [http://data.stats.gov.cn/english/easyquery.htm?m=QueryData&dbcode=fsnd&rowcode=reg&colcode=sj&wds=[{"wdcode":"zb","valuecode":"A090201"}]&dfwds=[{"wdcode":"sj","valuecode":"1995-2014"}]&k1=1472740901192]
#> Date: 2019-06-30 11:02
#> Status: 502
#> Content-Type: <unknown>
#> Size: 281 B
#> <BINARY BODY>
res <- httr::GET(url2)
res
#> Response [http://data.stats.gov.cn/english/easyquery.htm?m=QueryData&dbcode=fsnd&rowcode=reg&colcode=sj&wds=[{%22wdcode%22:%22zb%22,%22valuecode%22:%22A090201%22}]&dfwds=[{%22wdcode%22:%22sj%22,%22valuecode%22:%221995-2014%22}]&k1=1472740901192]
#> Date: 2019-06-30 11:02
#> Status: 502
#> Content-Type: <unknown>
#> Size: 281 B
#> <BINARY BODY>
res <- httr::GET(url2, httr::add_headers("User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36"))
res
#> Response [http://data.stats.gov.cn/english/easyquery.htm?m=QueryData&dbcode=fsnd&rowcode=reg&colcode=sj&wds=[{%22wdcode%22:%22zb%22,%22valuecode%22:%22A090201%22}]&dfwds=[{%22wdcode%22:%22sj%22,%22valuecode%22:%221995-2014%22}]&k1=1472740901192]
#> Date: 2019-06-30 11:02
#> Status: 502
#> Content-Type: <unknown>
#> Size: 281 B
#> <BINARY BODY>