Use
curlPerform(url = 'http://pubchem.ncbi.nlm.nih.gov/pug/pug.cgi', postfields =
q)
That gives me:
PCT-Data
PCT-Data_output
PCT-OutputData
PCT-OutputData_status
PCT-Status-Message
PCT-Status-Message_status
PCT-Status value=running/
/PCT-Status-Message_status
/PCT-Status-Message
/PCT-OutputData_status
PCT-OutputData_output
PCT-OutputData_output_waiting
PCT-Waiting
PCT-Waiting_reqid31406321645402938/PCT-Waiting_reqid
/PCT-Waiting
/PCT-OutputData_output_waiting
/PCT-OutputData_output
/PCT-OutputData
/PCT-Data_output
/PCT-Data
Rajarshi Guha wrote:
Hi, I am trying to use a CGI service (Pubchem PUG) via RCurl and am
running into a problem where the data must be supplied via POST - but I
don't know the keyword for the argument.
The data to be sent is an XML fragment. I can do this via the command
line using curl: I save the XML string to a file called query.xml and
then do
curl -d @query.xml http://pubchem.ncbi.nlm.nih.gov/pug/pug.cgi;
I get the expected response. More importantly, the verbose option shows:
Accept: */*
Content-Length: 1227
Content-Type: application/x-www-form-urlencoded
However, when I try to do this via RCurl, the data doesn't seem to get
sent:
q - PCT-Data PCT-Data_inputPCT-InputData
PCT-InputData_queryPCT-Query
PCT-Query_typePCT-QueryType
PCT-QueryType_qas
PCT-QueryActivitySummary
PCT-QueryActivitySummary_output
value=\summary-table\0/PCT-QueryActivitySummary_output
PCT-QueryActivitySummary_type
value=\assay-central\0/PCT-QueryActivitySummary_type
PCT-QueryActivitySummary_scids
PCT-QueryUids
PCT-QueryUids_ids
PCT-ID-List
PCT-ID-List_dbpccompound/PCT-ID-List_db
PCT-ID-List_uids
PCT-ID-List_uids_E3243128/PCT-ID-List_uids_E
/PCT-ID-List_uids
/PCT-ID-List
/PCT-QueryUids_ids
/PCT-QueryUids
/PCT-QueryActivitySummary_scids
/PCT-QueryActivitySummary /PCT-QueryType_qas
/PCT-QueryType /PCT-Query_type/PCT-Query
/PCT-InputData_query/PCT-InputData /PCT-Data_input/PCT-Data
postForm(url, q, style=post, .opts = list(verbose=TRUE))
* About to connect() to pubchem.ncbi.nlm.nih.gov port 80 (#0)
* Trying 130.14.29.110... * connected
* Connected to pubchem.ncbi.nlm.nih.gov (130.14.29.110) port 80 (#0)
POST /pug/pug.cgi HTTP/1.1
Host: pubchem.ncbi.nlm.nih.gov
Accept: */*
Content-Length: 0
Content-Type: application/x-www-form-urlencoded
As you can see, the data in q doesn't seem to get sent (content-length =
0).
Does anybody have any suggestions as to why the call to postForm doesn't
work, but the command line call does?
Thanks,
Rajarshi Guha| NIH Chemical Genomics Center
http://www.rguha.net | http://ncgc.nih.gov
Q: Why did the mathematician name his dog Cauchy?
A: Because he left a residue at every pole.
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.