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

RE: AW: question about example 2



   Mike - I'm getting lost.  I think I did what you suggested, but no data
   is POSTing to the PHP script.   I've acttached the code that I'm using.
     Do you see what I'm doing wrong?
   Larry Kleinman
   Kleinman Associates, Inc.
   212-949-6469
   From:        Mike Krebs <mkrebs@xxxxxxxxxxxxxxxxxx>
   To:        HTTPAPI and FTPAPI Projects <ftpapi@xxxxxxxxxxxxxxxxxxxxxx>,
   Date:        03/24/2015 12:22 PM
   Subject:        RE: AW: question about example 2
   Sent by:        ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
     __________________________________________________________________

   So, that is pretty straight forward. Just substitute your variables
   (RequestID, Reference, etc) for the from, subject and Comment in
   EXAMPLE2.
   You will have myPointer to the webform data when you are finished. Send
   that to http_url_post_raw in place of %addr(data). Send dataSize in
   place of %len(%trimr(data)). The rest you can use EXAMPLE5 for.
   -----Original Message-----
   From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
   [[1]mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Larry
   Kleinman
   Sent: Tuesday, March 24, 2015 10:57 AM
   To: HTTPAPI and FTPAPI Projects
   Subject: RE: AW: question about example 2
   The URL is a private one, which you will not be able to access.   It is
   only a PHP script with lines like
   $RequestID = $_POST["RequestID"]
   $Reference = $_POST["Reference"]
   so I want the RPG program to POST a value for RequestD and for
   Reference
   The script also does some simple ECHOs, and I want to get that back in
   retdata
   Larry Kleinman
   Kleinman Associates, Inc.
   212-949-6469
   From:   Mike Krebs <mkrebs@xxxxxxxxxxxxxxxxxx>
   To:     HTTPAPI and FTPAPI Projects <ftpapi@xxxxxxxxxxxxxxxxxxxxxx>,
   Date:   03/24/2015 11:42 AM
   Subject:        RE: AW: question about example 2
   Sent by:        ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
   Did you send us the url you are trying to post to? Using the webForm
   stuff
   it is pretty easy to create the right variable but reading the html and
   getting them right is not always easy. A URL would make it easier to
   help
   you.
   -----Original Message-----
   From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [
   [2]mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Larry
   Kleinman
   Sent: Tuesday, March 24, 2015 9:58 AM
   To: HTTPAPI and FTPAPI Projects
   Subject: Re: AW: question about example 2
   Hi Thomas - I've attached the source for EXAMPLE5.
   I can't figure out how to use it to POST data to the web form, and I
   suspect that it involves using some of the code in EXAMPLE2, which I've
   also attached.   I guess I am trying to combine the two of them into
   something which will POST several fields to a web form (like EXAMPLE 2
   does with fromAddr, subject, and message) , and put what was returned
   by
   the web site into data that I can manipulate (like EXAMPLE 5 foes with
   retdata)
   Larry Kleinman
   Kleinman Associates, Inc.
   212-949-6469
   From:   Thomas Raddatz <thomas.raddatz@xxxxxx>
   To:     "'HTTPAPI and FTPAPI Projects'"
   <ftpapi@xxxxxxxxxxxxxxxxxxxxxx>,
   Date:   03/24/2015 08:46 AM
   Subject:        AW: question about example 2
   Sent by:        ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
   Larry,
   It was great if you could send the source to me, since I do not have an
   archive of 1.23. The oldest archive I have is 1.25.
   Thomas.
   -----Ursprüngliche Nachricht-----
   Von: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [
   [3]mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] Im Auftrag von Larry
   Kleinman
   Gesendet: Dienstag, 24. März 2015 13:28
   An: HTTPAPI and FTPAPI Projects
   Cc: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
   Betreff: Re: question about example 2
   Yep, I am using the same version.   Thomas, do you need me to send you
   the
   source, or can you find it in an archive of version 1.23
   Larry Kleinman
   Kleinman Associates, Inc.
   212-949-6469
   From:   Thomas Bishop <tbishop2@xxxxxxxxxx>
   To:     "ftpapi@xxxxxxxxxxxxxxxxxxxxxx"
   <ftpapi@xxxxxxxxxxxxxxxxxxxxxx>,
   Date:   03/24/2015 08:08 AM
   Subject:        Re: question about example 2
   Sent by:        ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
   My copy of EXAMPLE5 also uses "raw".  Version 1.23
   Comment at top of EXAMPLE5 source code states:
   * This performs the same example as EXAMPLE4, except that it
   * uses the "raw" versio of http_url_post(). The advantage is
   * that data is received directly into a variable in the program
   * instead of writing it to the IFS.
   Source code contains the following:
   c                   eval      rc=http_url_post_raw(
   c                             'https://wwwcie.ups.com/ups.app' +
   c                             '/xml/Track':
   c                              %addr(data): %len(%trimr(data)):
   c                              1: %paddr('INCOMING'))
   c                   if        rc <> 1
   c                   eval      msg = http_error
   c                   dsply                   msg
   c                   return
   c                   endif
   The information transmitted is intended only for the person or entity
   to
   which it is addressed and may contain CONFIDENTIAL material.  If you
   receive this material/information in error, please contact the sender
   and
   delete or destroy the material/information.
   -----------------------------------------------------------------------
   This is the FTPAPI mailing list.  To unsubscribe, please go to:
   [4]http://www.scottklement.com/mailman/listinfo/ftpapi
   -----------------------------------------------------------------------
   --
   IMPORTANT NOTICE:
   This email is confidential, may be legally privileged, and is for the
   intended recipient only. Access, disclosure, copying, distribution, or
   reliance on any of it by anyone else is prohibited and may be a
   criminal
   offence. Please delete if obtained in error and email confirmation to
   the
   sender.
   -----------------------------------------------------------------------
   This is the FTPAPI mailing list.  To unsubscribe, please go to:
   [5]http://www.scottklement.com/mailman/listinfo/ftpapi
   -----------------------------------------------------------------------
   -----------------------------------------------------------------------
   This is the FTPAPI mailing list.  To unsubscribe, please go to:
   [6]http://www.scottklement.com/mailman/listinfo/ftpapi
   -----------------------------------------------------------------------
   -----------------------------------------------------------------------
   This is the FTPAPI mailing list.  To unsubscribe, please go to:
   [7]http://www.scottklement.com/mailman/listinfo/ftpapi
   -----------------------------------------------------------------------

References

   1. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
   2. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
   3. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
   4. http://www.scottklement.com/mailman/listinfo/ftpapi
   5. http://www.scottklement.com/mailman/listinfo/ftpapi
   6. http://www.scottklement.com/mailman/listinfo/ftpapi
   7. http://www.scottklement.com/mailman/listinfo/ftpapi
ÿþ  5761WDS V6R1M0  080215                  SEU SOURCE LISTING                            03/24/15 14:28:16    KANYC800     PAGE    1

  SOURCE FILE . . . . . . .  LIBHTTP/QRPGLESRC

  MEMBER  . . . . . . . . .  CCR001

  SEQNBR*...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... 8 ...+... 9 ...+... 0

    100       *  Do a POST to PHP script that will process credit card transactions                                     03/24/15

    200       *                                                                                                         03/24/15

    300       *******************************************************************                                       03/24/15

    400       *                                                                                                         03/24/15

    500       * This program is based on EXAMPLE5 from LIBHTTP                                                          03/24/15

    600       * COMPILE NOTE:  LIBHTTP must be in LIBL                                                                  03/24/15

    700       *                                                                                                         05/05/05

    800       *******************************************************************                                       03/24/15

    900       * Indicator Usage:                                                                                        03/24/15

   1000       *       49:  General purpose IF Statement                                                                 03/24/15

   1100       ******************************************************************                                        03/24/15

   1200       *  Parameters passed to this program:                                                                     03/24/15

   1300       *       NONE                                                                                              03/24/15

   1400       *                                                                                                         03/24/15

   1500       *   Parameters returned to calling program:                                                               03/24/15

   1600       *       NONE                                                                                              03/24/15

   1700       ******************************************************************                                        03/24/15

   1800       *  Modifications:                                                                                         03/24/15

   1900       *                                                                                                         03/24/15

   2000       *    New program.                                LK   3/24/15                                             03/24/15

   2100       *                                                                                                         03/24/15

   2200       ******************************************************************                                        03/24/15

   2300      H DFTACTGRP(*NO) ACTGRP(*NEW) BNDDIR('HTTPAPI')                                                            03/23/06

   2400                                                                                                                 10/21/01

   2500       /define WEBFORMS                                                                                          03/24/15

   2600      D/copy qrpglesrc,httpapi_h                                                                                 03/23/06

   2700                                                                                                                 10/21/01

   2800      D incoming        PR            10I 0                                                                      10/21/01

   2900      D   descriptor                  10I 0 value                                                                10/21/01

   3000      D   data                      8192A   options(*varsize)                                                    10/21/01

   3100      D   datalen                     10I 0 value                                                                10/21/01

   3200                                                                                                                 10/21/01

   3300      D rc              s             10I 0                                                                      10/21/01

   3400      D msg             s             52A                                                                        10/21/01

   3500      D CRLF            C                   CONST(x'0d25')                                                       10/21/01

   3600      D data            S           1024A                                                                        10/21/01

   3700      D tracknum        S             20A   inz('1Z12345E0390515214')                                            07/27/04

   3800      D retdata         S          32766A                                                                        10/21/01

   3900      D retlen          S             10I 0                                                                      10/21/01

   4000      D nextpos         S             10I 0 inz(1)                                                               10/21/01

   4100                                                                                                                 10/21/01

   4200      D Form            s                   like(WEBFORM)                                                        03/24/15

   4300      D RequestID       s            100A   varying                                                              03/24/15

   4400      D CreditAmt       s            100A   varying                                                              03/24/15

   4500      D Reference       s           1000A   varying                                                              03/24/15

   4600      D myPointer       s               *                                                                        03/24/15

   4700      D dataSize        s             10I 0                                                                      03/24/15

   4800      c                   eval      *inlr = *on                                                                  10/21/01

   4900                                                                                                                 10/21/01

   5000      c                   eval      RequestID = '4271247911975000001515'                                         03/24/15

   5100      c                   eval      CreditAmt = '1.50'                                                           03/24/15

   5200      c                   eval      Reference = 'This is a test'                                                 03/24/15

   5300       **                                                                                                        03/24/15

  5761WDS V6R1M0  080215                  SEU SOURCE LISTING                            03/24/15 14:28:16    KANYC800     PAGE    2

  SOURCE FILE . . . . . . .  LIBHTTP/QRPGLESRC

  MEMBER  . . . . . . . . .  CCR001

  SEQNBR*...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... 8 ...+... 9 ...+... 0

   5400       ** When a program emulates a form on an HTML page, it's called                                            03/24/15

   5500       ** a 'webform' in HTTPAPI.  You must first open a new web                                                 03/24/15

   5600       ** form, and then set variables in it:                                                                    03/24/15

   5700       **                                                                                                        03/24/15

   5800      C                   eval      Form = WEBFORM_open                                                          03/24/15

   5900                                                                                                                 03/24/15

   6000      c                   callp     WEBFORM_SetVar(Form: 'RequestID': RequestID )                                03/24/15

   6100      c                   callp     WEBFORM_SetVar(Form: 'CreditAmt': CreditAmt)                                 03/24/15

   6200      c                   callp     WEBFORM_SetVar(Form: 'Reference': Reference)                                 03/24/15

   6300                                                                                                                 03/24/15

   6400       **                                                                                                        03/24/15

   6500       ** The WEBFORM_postData() routine retrieves data suitable for                                             03/24/15

   6600       ** the http_url_post() API.  (there's also a WEBFORM_getData()                                            03/24/15

   6700       ** if you need to call HTTP_url_get).                                                                     03/24/15

   6800       **                                                                                                        03/24/15

   6900      c                   callp     WEBFORM_postData( Form : myPointer                                           03/24/15

   7000      c                                                    : dataSize )                                          03/24/15

   7100                                                                                                                 03/24/15

   7200       **                                                                                                        03/24/15

   7300      c*                  eval      data = ' '                                                                   03/24/15

   7400                                                                                                                 10/21/01

   7500      c                   eval      rc=http_url_post_raw(                                                        10/21/01

   7600      c                             'http://192.168.98.3/mitchells' +                                            03/23/15

   7700      c                             '/CreateCreditTest.php':                                                     03/24/15

   7800      c                              mypointer: dataSize:                                                        03/24/15

   7900      c                              1: %paddr('INCOMING'))                                                      03/24/15

   8000      c                   if        rc <> 1                                                                      10/21/01

   8100      c                   eval      msg = http_error                                                             10/21/01

   8200      c                   dsply                   msg                                                            10/21/01

   8300      c                   return                                                                                 10/21/01

   8400      c                   endif                                                                                  10/21/01

   8500                                                                                                                 10/21/01

   8600      C* convert the data we just received to EBCDIC                                                             10/21/01

   8700      c                   if        retlen > 1                                                                   10/21/01

   8800      c                   callp     http_xlate(retlen: retdata: TO_EBCDIC)                                       06/23/05

   8900      c                   endif                                                                                  10/21/01

   9000                                                                                                                 10/21/01

   9100      C* now the returned data is in the 'retdata' string.                                                       10/21/01

   9200      C*  run this program in debug and display retdata....  you'll see...                                       10/21/01

   9300      c                   return                                                                                 10/21/01

   9400                                                                                                                 10/21/01

   9500                                                                                                                 10/21/01

   9600      P*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++                                       10/21/01

   9700      P*  this procedure will receive the raw data received from UPS                                             10/21/01

   9800      P*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++                                       10/21/01

   9900      P incoming        B                                                                                        10/21/01

  10000      D incoming        PI            10I 0                                                                      10/21/01

  10100      D   descriptor                  10I 0 value                                                                10/21/01

  10200      D   data                      8192A   options(*varsize)                                                    10/21/01

  10300      D   datalen                     10I 0 value                                                                10/21/01

  10400                                                                                                                 10/21/01

  10500      C* Make sure we don't overflow the string:                                                                 10/21/01

  10600      c                   eval      retlen = (nextpos + datalen) - 1                                             10/21/01

  5761WDS V6R1M0  080215                  SEU SOURCE LISTING                            03/24/15 14:28:16    KANYC800     PAGE    3

  SOURCE FILE . . . . . . .  LIBHTTP/QRPGLESRC

  MEMBER  . . . . . . . . .  CCR001

  SEQNBR*...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... 8 ...+... 9 ...+... 0

  10700      c                   if        retlen > %size(retdata)                                                      10/21/01

  10800      c                   eval      datalen=datalen-(retlen-%size(retdata))                                      09/22/04

  10900      c                   endif                                                                                  10/21/01

  11000                                                                                                                 10/21/01

  11100      C* If there is nothing to write, return THAT...                                                            10/21/01

  11200      c                   if        datalen < 1                                                                  10/21/01

  11300      c                   return    0                                                                            10/21/01

  11400      c                   endif                                                                                  10/21/01

  11500                                                                                                                 10/21/01

  11600      C* Here we add any data sent to the end of our 'retdata' string:                                           10/21/01

  11700      c                   eval      %subst(retdata: nextpos) =                                                   10/21/01

  11800      c                                %subst(data:1:datalen)                                                    10/21/01

  11900      c                   eval      nextpos = nextpos + datalen                                                  10/21/01

  12000                                                                                                                 10/21/01

  12100      c* We always return the amount of data that we wrote.   Note                                               10/21/01

  12200      C*  that if http-api sees that we didn't write as much data as                                             10/21/01

  12300      C*  it sent us, it'll abort the process with an error message.                                             10/21/01

  12400      c                   return    datalen                                                                      10/21/01

  12500      P                 E                                                                                        10/21/01

                                  * * * *  E N D  O F  S O U R C E  * * * *

-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------