Html 这个URL存在吗?RCurl说不
感兴趣的URL是:Html 这个URL存在吗?RCurl说不,html,xml,r,web-scraping,rcurl,Html,Xml,R,Web Scraping,Rcurl,感兴趣的URL是: http://patft.uspto.gov/netacgi/nph-Parser?Sect1=PTO2&Sect2=HITOFF&u=/netahtml/PTO/search-adv.htm&r=10&f=G&l=50&d=PTXT&OS=AN/(nortel)&RS=AN/nortel&Query=AN/(nortel)&Srch1=nortel.ASNM.&NextList1=Nex
http://patft.uspto.gov/netacgi/nph-Parser?Sect1=PTO2&Sect2=HITOFF&u=/netahtml/PTO/search-adv.htm&r=10&f=G&l=50&d=PTXT&OS=AN/(nortel)&RS=AN/nortel&Query=AN/(nortel)&Srch1=nortel.ASNM.&NextList1=Next 50 Hits
用于测试其存在性的所选函数为:
> url.exists("http://patft.uspto.gov/netacgi/nph-Parser?Sect1=PTO2&Sect2=HITOFF&u=/netahtml/PTO/search-adv.htm&r=10&f=G&l=50&d=PTXT&OS=AN/(nortel)&RS=AN/nortel&Query=AN/(nortel)&Srch1=nortel.ASNM.&NextList1=Next 50 Hits")
[1] FALSE
为什么我没有工作?URL显然存在并在chrome中解析,在URL上使用
htmlTreeParse
就可以了 我猜url.exists
正在使用HTTP头请求,服务器似乎无法处理该请求:
$ telnet patft.uspto.gov 80
Trying 151.207.240.26...
Connected to patft.uspto.gov.
Escape character is '^]'.
HEAD /netacgi/nph-Parser?Sect1=PTO2&Sect2=HITOFF&u=/netahtml/PTO/search-adv.htm&r=10&f=G&l=50&d=PTXT&OS=AN/(nortel)&RS=AN/nortel&Query=AN/(nortel)&Srch1=nortel.ASNM.&NextList1=Next+50+Hits HTTP/1.1
Host: patft.uspto.gov
Connection: close
Connection closed by foreign host.
所以服务器坏了,不是RCurl。这是无效的,所以我猜测至少需要将空格转义为
+
或%20
,也许您也需要转义括号,我不确定。浏览器通常都非常宽松,为您这样做为什么htmlTreeParse会在它上面工作?不知道,它必须在内部进行适当的转义才能工作,它不能在HTTP请求中使用(URL与HTTP/1.1版本字符串之间有一个空格),无论是哪种方式,根据URL RFC,它的格式都不正确。仅限制空格将使URL工作,但URL.exists
似乎仍然报告为FALSE。此外,它没有正确响应HEAD请求,而URL.exists
可能正在使用