- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
这个问题是我几年前在这里发布的一个问题 Send SQL string through POST with httr package in R .
基本思路是用R下载这里生成的zip文件https://www.transtats.bts.gov/DL_SelectFields.aspx?gnoyr_VQ=FIL&QO_fu146_anzr=Nv4%20Pn44vr45 .
当访问上面的网站时,我们可以从一个表格中选择我们想要的变量、年份和月份(或所有月份),然后按下载。以前,当我右键单击 POST 行并选择“复制为 cURL”时,我会得到一组非常好的代码,我可以将其转换为:
httr::POST(
url = "https://www.transtats.bts.gov/DownLoad_Table.asp",
httr::add_headers(
Referer = "https://www.transtats.bts.gov/DL_SelectFields.asp?Table_ID=289"
),
body = list(
UserTableName = "DB1BCoupon",
DBShortName = "",
RawDataTable = "T_DB1B_COUPON",
sqlstr = " SELECT ORIGIN_AIRPORT_ID,ORIGIN_AIRPORT_SEQ_ID,ORIGIN_CITY_MARKET_ID,DEST_AIRPORT_ID,DEST_AIRPORT_SEQ_ID,DEST_CITY_MARKET_ID FROM T_DB1B_COUPON WHERE Quarter=1 AND YEAR=2018",
varlist = "ORIGIN_AIRPORT_ID,ORIGIN_AIRPORT_SEQ_ID,ORIGIN_CITY_MARKET_ID,DEST_AIRPORT_ID,DEST_AIRPORT_SEQ_ID,DEST_CITY_MARKET_ID",
grouplist = "", suml = "",
sumRegion = "", filter1 = "title=",
filter2 = "title=", geo = "All\xa0",
time = "Q+1", timename = "Quarter",
GEOGRAPHY = "All", XYEAR = "2018",
FREQUENCY = "1",
VarDesc = "ItinID", VarType = "Num",
VarDesc = "MktID", VarType = "Num",
VarDesc = "SeqNum", VarType = "Num",
VarDesc = "Coupons", VarType = "Num",
VarDesc = "Year", VarType = "Num", VarName = "ORIGIN_AIRPORT_ID",
VarDesc = "OriginAirportID", VarType = "Num", VarName = "ORIGIN_AIRPORT_SEQ_ID",
VarDesc = "OriginAirportSeqID", VarType = "Num", VarName = "ORIGIN_CITY_MARKET_ID",
VarDesc = "OriginCityMarketID", VarType = "Num",
VarDesc = "Quarter", VarType = "Num",
VarDesc = "Origin", VarType = "Char",
VarDesc = "OriginCountry", VarType = "Char",
VarDesc = "OriginStateFips", VarType = "Char",
VarDesc = "OriginState", VarType = "Char",
VarDesc = "OriginStateName", VarType = "Char",
VarDesc = "OriginWac", VarType = "Num", VarName = "DEST_AIRPORT_ID",
VarDesc = "DestAirportID", VarType = "Num", VarName = "DEST_AIRPORT_SEQ_ID",
VarDesc = "DestAirportSeqID", VarType = "Num", VarName = "DEST_CITY_MARKET_ID",
VarDesc = "DestCityMarketID", VarType = "Num",
VarDesc = "Dest", VarType = "Char",
VarDesc = "DestCountry", VarType = "Char",
VarDesc = "DestStateFips", VarType = "Char",
VarDesc = "DestState", VarType = "Char",
VarDesc = "DestStateName", VarType = "Char",
VarDesc = "DestWac", VarType = "Num",
VarDesc = "Break", VarType = "Char",
VarDesc = "CouponType", VarType = "Char",
VarDesc = "TkCarrier", VarType = "Char",
VarDesc = "OpCarrier", VarType = "Char",
VarDesc = "RPCarrier", VarType = "Char",
VarDesc = "Passengers", VarType = "Num",
VarDesc = "FareClass", VarType = "Char",
VarDesc = "Distance", VarType = "Num",
VarDesc = "DistanceGroup", VarType = "Num",
VarDesc = "Gateway", VarType = "Num",
VarDesc = "ItinGeoType", VarType = "Num",
VarDesc = "CouponGeoType", VarType = "Num"
),
encode = "form",
query = list(
Table_ID = "289",
Has_Group = "0",
Is_Zipped = "0"
)
) -> res
用于提取 cURL 的代码是这样的:
library(curlconverter)
straighten() %>% make_req() -> tmp
新保存的资源包含二进制数据,我可以轻松使用它来下载 POST 生成的 zip 文件。
res
## Response [https://transtats.bts.gov/ftproot/TranStatsData/351117019_T_DB1B_COUPON.zip]
## Date: 2018-10-14 02:18
## Status: 200
## Content-Type: application/x-zip-compressed
## Size: 14.6 MB
## <BINARY BODY>
但是,当我现在做同样的事情时,它一团糟,我无法从中得到任何东西。
httr::VERB(
verb = "GET", url = "https://www.transtats.bts.gov/DL_SelectFields.aspx",
query = list(
gnoyr_VQ = "FIL",
QO_fu146_anzr = "Nv4+Pn44vr45' -X 'POST' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' -H 'Content-Type: application/x-www-form-urlencoded' -H 'Origin: https://www.transtats.bts.gov' -H 'Cookie: _ga=GA1.2.279767402.1654087030; _ga_NQ5ZN114SB=GS1.1.1654601577.6.1.1654602173.0; _gat_gtag_UA_18660041_1=1; _gid=GA1.2.975702239.1654601578; f5avr1969959209aaaaaaaaaaaaaaaa_cspm_=DKBJFJCFEDEGJMPHAKDLLGKAOMIGFJJBLFKJJFLCOKMFKOPOIBLJNFBDAENMKNMNNBNCKLDMCJCFKOMIFAFAGDCBBEIKHALBFLPDDHNGGPNBOHCDHALHLHAFCPDCECCK; _gat=1; __utma=261918792.279767402.1654087030.1654149013.1654601578.6; __utmb=261918792.6.10.1654601578; __utmc=261918792; __utmz=261918792.1654087030.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); _ga=GA1.3.279767402.1654087030; _gat_b=1; _gid=GA1.3.975702239.1654601578; has_js=1; QSI_SI_e8TSnTOxZxScWdT_intercept=true; QSI_HistorySession=https://www.transtats.bts.gov/DL_SelectFields.aspx?gnoyr_VQ=GEE&QO_fu146_anzr=Nv4%20Pn44vr45~1653914765211|https://www.transtats.bts.gov/DL_SelectFields.aspx?gnoyr_VQ=GEE&QO_fu146_anzr=Nv4+Pn44vr45~1653918802064|https://www.transtats.bts.gov/DL_SelectFields.aspx?gnoyr_VQ=FIL&QO_fu146_anzr=Nv4%20Pn44vr45~1653926488227|https://www.transtats.bts.gov/DL_SelectFields.aspx?gnoyr_VQ=FIL&QO_fu146_anzr=Nv4+Pn44vr45~1653933301130|https://www.transtats.bts.gov/DL_SelectFields.aspx?gnoyr_VQ=FJE&QO_fu146_anzr=Nv4Pn44vr45~1653943359984|https://www.transtats.bts.gov/DL_SelectFields.aspx?gnoyr_VQ=FIL&QO_fu146_anzr=Nv4+Pn44vr45~1654090368888|https://www.transtats.bts.gov/DL_SelectFields.aspx?gnoyr_VQ=FIL&QO_fu146_anzr=Nv4%20Pn44vr45~1654092812643|https://www.transtats.bts.gov/DL_SelectFields.aspx?gnoyr_VQ=FLM&QO_fu146_anzr=b4vtv0+n0q+Qr56v0n6v10+f748rB~1654094623107|https://www.transtats.bts.gov/DL_SelectFields.aspx?gnoyr_VQ=FIL&QO_fu146_anzr=Nv4%25Pn44vr45~1654102786829|https://www.transtats.bts.gov/DL_SelectFields.aspx?gnoyr_VQ=FIL&QO_fu146_anzr=Nv4+Pn44vr45~1654601914519; f5avraaaaaaaaaaaaaaaa_session_=PBGOPMEEHCNFKKAPFNCACAKCCBFOPNPHICHCBEFGHCMKMLBFFNNFBOCOFLEKPFCNHNLDMANNOIAOFKNKGMJADPMKGDFMDGGEFHKCCGNOLACEFOLDEKIKCIOLAIIANEKM; ASPSESSIONIDQCQCSDSA=JPCOCLGDHAIJOKGLBBJNAKCN; _ga_TS9639848Y=GS1.1.1654095826.2.0.1654095826.0; ASPSESSIONIDQCSATBTA=PFAPIPGDONFFBLDGBBMOOAJO; ASP.NET_SessionId=wr043omrzfn1emifxmj1wadr; ASPSESSIONIDQCSASBTB=BMMLLHNBPOKMOHFPOHEOJOOB' -H 'Content-Length: 8825' -H 'Accept-Language: en-us' -H 'Host: www.transtats.bts.gov' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.2 Safari/605.1.15' -H 'Referer: https://www.transtats.bts.gov/DL_SelectFields.aspx?gnoyr_VQ=FIL",
QO_fu146_anzr = "Nv4+Pn44vr45' -H 'Accept-Encoding: gzip, deflate, br' -H 'Connection: keep-alive' --data '__EVENTTARGET=chkAllVars",
`__EVENTARGUMENT` = "",
`__LASTFOCUS` = "", `__V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7fQWzcIImYdN4hUEUoSEq/d1BC4UxKFph+UCXz/guz6lFJy4m0s7SGp5Rt3XDSHZEV/flFjSWK0QsJ+NLOQ+cUmbP1Ftp1kzc7Qk4c3mWflvun+H8Y98mJqntquxAMrCbyQENnFcEMhR7hq5fA5VkEwO2Ks3JKdwR690C9E6dSeYl1Z5IlK4SzYpsCU/mv2iZ5Mv/ALdOX3t2vLTedH4pAqbO1+x8HQP0IOxJOpxpQiv8CbBpkCRNvQGhESuWGgloGXag0GRnJd1LqLak1aowvcGEJmVI3Z01Kg9OJwFyaLamVWZx9t4GfCBPkXK3Ep8sW8uvARqxolVuuK1fNeJwFAD05a8VqKnD30Fe7Bn5oI0CLwiIsB8Ou7W5yExnBHmBTyeNzMP/0qeo6PTCbH88UrD9DPPXWMFXWvR7cXpAeSRsAHjtbVPwFq3bNxEunExbP54adWifEPsQs7zmBf8xQV2W1F2Rd1wmJ7DvfhwyVyITcUGig4/WcBHkEFHtCHuQvNzWTePbP5osJgeM+pTDU=",
txtSearch = "", cboGeography = "All",
cboYear = "2022", cboPeriod = "All",
chkAllVars = "on", UNIQUE_CARRIER = "on",
UNIQUE_CARRIER_NAME = "on",
ORIGIN_AIRPORT_ID = "on",
ORIGIN = "on", DEST_AIRPORT_ID = "on",
DEST = "on", MONTH = "on"
)
) -> res
事实上,当尝试运行该 res 时,它不会再获得任何 zip 文件,我怀疑这是由于此 __EVENTVALIDATION
和/或 __VIEWSTATE
。我已经阅读了很多有关它的内容,但我仍然不知道如何绕过它,所以我可以从 R 下载 zip 文件。
最佳答案
通过执行此操作修复。我不确定为什么我需要第二个请求。一个使用 GET,一个使用 getURL。由于某种原因,似乎没有 GET 请求不会创建 cookie。但是,它有效。但如果有人能解释原因,那就太棒了。
curl <- getCurlHandle()
curlSetOpt(cookiejar = paste(tempdir(), "/", "cookies.txt", sep = ""),
followlocation = TRUE, autoreferer = TRUE, curl = curl)
message("Connecting to T100")
html <- getURL("https://www.transtats.bts.gov/DL_SelectFields.aspx?gnoyr_VQ=FIM&QO_fu146_anzr=Nv4%25Pn44vr45", curl = curl)
temp <- GET("https://www.transtats.bts.gov/DL_SelectFields.aspx?gnoyr_VQ=FIM&QO_fu146_anzr=Nv4%25Pn44vr45", curl = curl)
message("Done")
viewstate <- as.character(sub('.*id="__VIEWSTATE" value="([0-9a-zA-Z+/=]*).*', '\\1', html))
viewstategenerator <- as.character(sub('.*id="__VIEWSTATEGENERATOR" value="([0-9a-zA-Z+/=]*).*', '\\1', html))
eventvalidation <- as.character(sub('.*id="__EVENTVALIDATION" value="([0-9a-zA-Z+/=]*).*', '\\1', html))
message("Downloading file")
httr::POST(
config = progress(),
url = "https://www.transtats.bts.gov/DL_SelectFields.aspx?gnoyr_VQ=FIM&QO_fu146_anzr=Nv4+Pn44vr45",
httr::add_headers(
Referer = "https://www.transtats.bts.gov/DL_SelectFields.aspx?gnoyr_VQ=FIM&QO_fu146_anzr=Nv4%25Pn44vr45"
),
body = list(
'__EVENTARGUMENT' = "",
'__LASTFOCUS' = "",
"__VIEWSTATE" = viewstate,
'__VIEWSTATEGENERATOR' = viewstategenerator,
'__EVENTVALIDATION' = eventvalidation,
txtSearch = "",
btnDownload = "Download",
cboGeography = "All",
cboYear = y,
cboPeriod = "All",
chkAllVars = "on",
UNIQUE_CARRIER = "on",
UNIQUE_CARRIER_NAME = "on",
ORIGIN_AIRPORT_ID = "on",
ORIGIN = "on",
DEST_AIRPORT_ID = "on",
DEST = "on",
MONTH = "on"
),
encode = "form", query = list(
gnoyr_VQ = "FIM",
QO_fu146_anzr = "Nv4+Pn44vr45"
),
postData = list(
text = paste("__EVENTTARGET=&__EVENTARGUMENT=&__LASTFOCUS=&__VIEWSTATE=", viewstate,
"&__VIEWSTATEGENERATOR=", viewstategenerator,
"&__EVENTVALIDATION=", eventvalidation,
"&txtSearch=&cboGeography=All&cboYear=",y,"&cboPeriod=All&btnDownload=Download&UNIQUE_CARRIER=on&UNIQUE_CARRIER_NAME=on&ORIGIN_AIRPORT_ID=on&ORIGIN=on&DEST_AIRPORT_ID=on&DEST=on&MONTH=on",
sep = "")
)
)
关于r - 从网站提取 POST 请求不再工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72530662/
我有这个网站,这个特定页面是安全的,但是当它回发时,它回发到一个不安全的页面。如何解决? 我正在使用 ASP.NET 向导。我有这个页面 - checkout.aspx,页面包含这个控件 checko
我有 2 个 azure 网站 - 两个独立的项目 我现在有 2 个网址: myazurewebsite.azurewebsites.net myazureblog.azurewebsites.net
我有 2 个 azure 网站 - 两个独立的项目 我现在有 2 个网址: myazurewebsite.azurewebsites.net myazureblog.azurewebsites.net
环境: 旧网站: React 托管在 Heroku URL( http://sameurl.com ) 新网站: Java 托管在 Heroku URL ( http://sameurl.com )
我已在 Windows Azure 上注册了一个测试帐户来对其进行测试。我构建了一个 Hello world ASP.NET Web 应用程序 + 数据库只是为了测试。 我安装了 Visual Stu
我有一个可以收集和显示各种测量值的产品(不会详细介绍)。正如人们所期望的那样,显示部分是一个数据库+建立在其之上的网站(使用 Symfony)。 但是,我们可能还会创建一个 API 来向第三方公开数据
这个问题在这里已经有了答案: Software keyboard resizes background image on Android (16 个答案) 关闭 8 年前。 我有一个类似的问题:So
这个问题似乎很常见,但我真的无法根据现有答案解决问题。 我有一个简单的 maven 项目,没有任何复杂的部署配置等,并且想在点击“mvn site”时生成一个 Maven CheckStyle 报告。
有没有人看过有关何时进行横向扩展与纵向扩展的最佳选择的任何分析或信息。什么时候一个比另一个更有意义。 目前,在标准模式和基本模式下,2 个小型实例的费用与 1 个中型实例的费用相同。 拥有 2 个小型
有没有办法找到 azure 网站何时停止? (我通过门户网站停止了网站,但我不记得是什么时候......) 我正在寻找一些日志,但没有找到任何有用的内容。 谢谢。 最佳答案 您拥有的最接近的是 azu
我目前在 Azure VM 的 IIS 中拥有一个网站。我已将该站点复制到 2 个可用区域中的 2 个虚拟机上。 这可以保护网站免遭停机。 我需要为高负载时刻实现一些可扩展性。这似乎就是创建音阶集的目
我有一个托管在 Azure 上的网站 ( http://mike-ward.azurewebsites.net/ )。我从 Azure 门户设置了一个指向(引用?)我的网站的 Azure CDN。根据
我有一个 Azure 网站(不是 Web 角色),有 2 个槽:生产和暂存。 我只想为生产插槽启用 CDN,而不是为登台启用,问题是我找不到识别主机插槽的方法。 RoleEnvironment 不可用
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 我们不允许提出有关书籍、工具、软件库等建议的问题。您可以编辑问题,以便可以用事实和引用来回答它。 4年前关
我们正在考虑将一些网站从 Azure 云服务迁移到 Azure 网站(事情似乎就是这样进行的)。显然,我们被明确告知云服务不会保留文件系统状态,因为它们会在机器故障时重新部署。 我假设网站是基于 Bl
我有一个 Azure 网站,需要使用在 VM 上运行的 Elasticsearch 服务。 虽然我需要能够锁定对 Elasticsearch 的访问,以便只有 Azure 网站可以访问它,但我似乎无法
我有一个 azure 网站,位于 yis3.azurewebsites.net - 我已将其提升为“共享”网站,以便我可以使用自定义域。我拥有从 123-reg.co.uk 购买的域名 yorkshi
我正在使用 abcPDF 动态创建 PDF。 我想保存这些 PDF,以便客户随时检索。最简单的方法(也是我现在在当前服务器上所做的方法)是将完成的 PDF 保存到文件系统。 看来我一直坚持使用 blo
我们正在尝试了解 Windows Azure 管理 API 为 Azure 网站(而非 Webroles)返回的监控数据的复杂性 例如,下图描述了为 CPUTime 检索的数据点。它似乎表明,在晚上
看起来真的很愚蠢,因为我找不到它: 门户网站似乎不太直观,我如何为一个“网站”付费并在其中运行最多 500 个网站?我想当我通过单击左下角的加号添加“网站”时,我添加了整个虚拟机而不是子站点。如何仅添
我是一名优秀的程序员,十分优秀!