RCurl postForm获取不正确的数据

时间:2014-05-15 12:33:58

标签: r rcurl

我想在R

中复制以下内容
curl -XPOST -H 'Content-Type: application/json' -d '{"input":{"webpage/url":"http://http://www.mutualart.com/Exhibitions/Richard-Hamilton/4BC4569A3DCC902A"}}' "https://api.import.io/store/connector/13235010-2b34-4ddb-b8b7-245f12158424/_query?_user=63d1abec-6dde-4387-a5ac-75208005a0cb&_apikey=YOUR_API_KEY"

在Linux下,这可行,我得到正确的输出(输出中的页面URL匹配x)。但是,在R中,我得到了错误的输出 - 我得到了http://www.mutualart.com/Exhibitions/Bailey-s-Stardust/14180718CB6BBBFF

的输出

到目前为止,我的R代码是

    x= list(items=c("http://www.mutualart.com/Exhibitions/Richard-Hamilton/4BC4569A3DCC902A"))

    headers <- list('Accept' = 'application/json', 'Content-Type' = 'application/json')

    uri <- "http://api.import.io/store/connector/13235010-2b34-4ddb-b8b7-245f12158424/_query?_user=63d1abec-6dde-4387-a5ac-75208005a0cb&_apikey=rhq3RoF9oXsoFLwPVfM%2Fkk7ephcJg0bqfbj51PPYhEbkITRm%2Fn23TvtJU4wVWfOkPBjL0sdhZTH5tZg%2Bom72iw%3D%3D"

    postForm(uri, .opts=list(postfields=toJSON(x), httpheader=headers))

0 个答案:

没有答案