> resp <- postForm('http://our.db/db/new',
'profileid'='181133',
'value'='20110225',
'type'='history','user-agent' = 'R', .opts
=list(verbose=T, userpwd='test:test'))
* About to connect() to our.db port 80 (#0)
* Trying 192.168.1.1... * connected
* Connected to our.db (192.168.1.1) port 80 (#0)> POST /db/new HTTP/1.1
Host: our.db
Accept: */*
Content-Length: 452
Expect: 100-continue
Content-Type: multipart/form-data;
boundary=----------------------------ffe8790c93da
< HTTP/1.1 100 Continue
< HTTP/1.1 401 Unauthorized
< Date: Fri, 25 Feb 2011 19:27:41 GMT
< WWW-Authenticate: Basic realm="US"
< Content-Type: text/html; charset=iso-8859-1
< Cache-Control: must-revalidate,no-cache,no-store
< Content-Length: 1378
< Server: Jetty(6.1.25)
<
* Ignoring the response-body
* Connection #0 to host our.db left intact
* Issue another request to this URL: 'http://our.db/db/new'
* Re-using existing connection! (#0) with host our.db
* Connected to our.db (192.168.1.1) port 80 (#0)
* Server auth using Basic with user 'test'> POST /db/new HTTP/1.1
Authorization: Basic dGVzdDp0ZXN0
Host: our.db
Accept: */*
Content-Length: 452
Expect: 100-continue
Content-Type: multipart/form-data;
boundary=----------------------------41b86db89985
< HTTP/1.1 100 Continue
< HTTP/1.1 500 null
< Date: Fri, 25 Feb 2011 19:27:41 GMT
< Content-Type: text/html; charset=iso-8859-1
< Cache-Control: must-revalidate,no-cache,no-store
< Content-Length: 2919
< Server: Jetty(6.1.25)
<
* Connection #0 to host our.db left intact
X> print(resp)
[1] "<html>\n<head>\n<meta
http-equiv=\"Content-Type\" content=\"text/html;
charset=ISO-8859-1\"/>\n<title>Error 500
null</title>\n</head>\n<body><h2>HTTP ERROR
500</h2>\n<p>Problem accessing
/db/new. Reason:\n<pre> null</pre></p><h3>Caused
by:</h3><pre>javax.servlet.ServletException: null\n\tat
com.erm.web.NewDistServlet.doPost(NewDistServlet.java:107)\n\tat
javax.servlet.http.HttpServlet.service(HttpServlet.java:727)\n\tat
javax.servlet.http.HttpServlet.service(HttpServlet.java:820)\n\tat
org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)\n\tat
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)\n\tat
org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)\n\tat
org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)\n\tat
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)\n\tat
org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:440)\n\tat
org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)\n\tat
org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)\n\tat
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)\n\tat
org.mortbay.jetty.Server.handle(Server.java:326)\n\tat
org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)\n\tat
org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:943)\n\tat
org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)\n\tat
org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)\n\tat
org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)\n\tat
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)\n\tat
org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)\n</pre>\n<hr
/><i><small>Powered by
Jetty://</small></i><br/>
\n<br/>
\n<br/>
\n<br/>
\n<br/>
\n<br/>
\n<br/>
\n<br/>
\n<br/>
\n<br/>
\n<br/>
\n<br/>
\n<br/>
\n<br/>
\n<br/>
\n<br/>
\n<br/>
\n<br/>
\n<br/>
\n<br/>
\n\n</body>\n</html>\n"
attr(,"Content-Type")
charset
"text/html" "iso-8859-1">
With curl on from command line:
% /usr/bin/curl -u test:test -vvv -d'profileid=181133'
-d'value=20110225'
-d'type=history' http://our.db.host/db/new
* About to connect() to our.db.host port 80 (#0)
* Trying 192.168.1.1... connected
* Connected to our.db.host (192.168.1.1) port 80 (#0)
* Server auth using Basic with user 'test'> POST /db/new HTTP/1.1
> Authorization: Basic dGVzdDp0ZXN0
> User-Agent: curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.19.7
OpenSSL/0.9.8l zlib/1.2.3> Host: our.db.host
> Accept: */*
> Content-Length: 44
> Content-Type: application/x-www-form-urlencoded
>
< HTTP/1.1 201 Created
< Date: Fri, 25 Feb 2011 19:41:51 GMT
< Content-Length: 0
< Server: Jetty(6.1.25)
<
* Connection #0 to host our.db.host left intact
* Closing connection #0
All I want to do is duplicate the curl command's output with RCurl. Help?
Thanks in advance!
--
Hasan Diwan
Developer
Economic Risk Management LLC
[[alternative HTML version deleted]]