[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

HTTPAPI post trouble



Sender: Sean Porterfield <sporter@xxxxxxxxxxxx>

This is my first time attempting to use post with HTTPAPI.  (Actually,
my first use of the API other than downloading the new FTPAPI SAVF.)

I'm going to be uploading and downloading files from a bank.  I already
took care of the SSL certificate portion, but when I posted the logon
page, I got a 400 error with no details.

I figured it would be better if I figured out the POST before introducing
the complications of the bank and all their "features" so I am using the
URL in the program below.  All it does is print out POST variables to show
what was sent.

I don't see any difference between this and EXAMPLE2, yet my program
doesn't work.  I get html tags returned as if I didn't send any POST data.
The web server log shows a really long (blank) line with each request.

I had started with my URI in a variable but changed to the code below to
simplify it as much as possible.

If anyone wants to prove that the return.php script works, ther is a test
script at http://mail.bestdist.com/test/test.php that posts to return.php

Any idea what I'm doing wrong?  (I automatically assume I've done
something wrong!)

I'm on V5R2 using HTTPAPI 1.10


H DFTACTGRP(*NO) ACTGRP(*NEW) BNDDIR('LIBHTTP/HTTPAPI')


D/copy libhttp/qrpglesrc,httpapi_h

     D CRLF            C                   CONST(x'0D25')
     D rc              s             10I 0
     D msg             s             52A
     D data            s           1024A

     c                   eval      data = 'user=test&password=pass' +
     c                             '&submit=Submit' + CRLF
     c                   eval      rc = http_url_post('http://mail.bestdist.' +
     c                             'com/return.php':
     c                             %addr(data):
     c                             %len(%trimr(data)):
     c                             '/tmp/return.php')
     c                   if        rc <> 1
     c                   eval      msg = http_error
     c                   dsply                   msg
     c                   return
     c                   endif

     c                   eval      *inlr = *on
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubsribe from the list send mail
to majordomo@xxxxxxxxxxxxx with the body: unsubscribe ftpapi mymailaddr
-----------------------------------------------------------------------