josh803316 has asked for the wisdom of the Perl Monks concerning the following question:
Any ideas if I am doing this wrong? Do I need to use the following options instead?(Command Line Example that works) shell#curl -d 'level=2&pass=password&hsam_timeout=20' -k https://1.1.1 +.1/auth AUTH: OK SESSION: 4221231856 (EXAMPLE TEST with module distro t/new/06http-post.t) $curl->setopt( CURLOPT_URL, $ENV{CURL_TEST_URL} ); $curl->setopt( CURLOPT_READFUNCTION, \&read_callback ); $curl->setopt( CURLOPT_INFILESIZE, $max ); $curl->setopt( CURLOPT_UPLOAD, 1 ); $curl->setopt( CURLOPT_CUSTOMREQUEST, 'POST' ); my $code = $curl->perform; (My code that also turns off the ssl check) $curl->setopt( CURLOPT_URL,'https://1.1.1.1/auth?level=2&pass=password +&hsam_timeout=20' ); $curl->setopt( CURLOPT_READFUNCTION, \&read_callback ); $curl->setopt( CURLOPT_INFILESIZE, $max ); $curl->setopt( CURLOPT_UPLOAD, 1 ); $curl->setopt( CURLOPT_CUSTOMREQUEST, 'POST' ); $curl->setopt(CURLOPT_SSL_VERIFYPEER,0); $curl->setopt(CURLOPT_SSL_VERIFYHOST,0); my $code = $curl->perform;
$curl->setopt( CURLOPT_POST, 1); $curl->setopt( CURLOPT_POSTFIELDSIZE, 100); $curl->setopt( CURLOPT_POSTFIELDS, "level=2&pass=password&hsam_timeout +=20");
> POST /auth?level=2&pass=password&hsam_timeout=20 HTTP/1.1 Host: 10.2.200.101 Accept: */* Content-Length: 100 Expect: 100-continue < HTTP/1.1 417 Expectation Failed < Connection: close < Content-Length: 0 < Date: Tue, 19 May 2009 02:16:25 GMT < Server: httpd < * Closing connection #0
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Correct way to POST with Perl Curl?
by Anonymous Monk on May 19, 2009 at 03:56 UTC | |
by josh803316 (Beadle) on May 19, 2009 at 06:30 UTC | |
by josh803316 (Beadle) on May 19, 2009 at 06:37 UTC |