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

RE: HTTPAPI http_url_get



Hi,

Thanks for the quick reply, If I use that though doesn’t it write to the ifs too?

Is HTTP_RAW_SAVE a procedure?

John

-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Chris Edmondson
Sent: 27 October 2016 15:57
To: HTTPAPI and FTPAPI Projects <ftpapi@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re: HTTPAPI http_url_get

Hi John,

You can use http_url_get_raw as shown below:

rc = http_url_get_raw(url: fd: %paddr(HTTP_RAW_SAVE));
>
>
Where the HTTP_RAW_SAVE procedure looks like:

 *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  *   This is called by the HTTP_url_get_raw() API each time
>  *   data is received from the HTTP server.
>  *
>  *   We use it to show the user how many bytes have been
>  *   received, and then we write the received data to disk.
>  *
>  *   Parameters:
>  *        peFD = number that we passed to HTTP_url_get_raw().
>  *               (We use the file descriptor that we got when
>  *                we opened the stream file that we're saving to)
>  *      peData = pointer to the data that was received from http
>  *                server.
>  *       peLen = length of data received
>  *
>  *   we return the length we received from HTTPAPI if successful
>  *     or -1 if we can't write the data to disk.
>  *++++++++++++++++++++++++++++++++++++++++++++++++++++++
> P http_raw_save   B
> D http_raw_save   PI            10I 0
> D   peFD                        10I 0 value
> D   peData                        *   value
> D   peLen                       10I 0 value
> d
> d peDta           s          32000a   based(peData)
>
> D QMHSNDPM        PR                  ExtPgm('QMHSNDPM')
> D   MessageID                    7A   Const
> D   QualMsgF                    20A   Const
> D   MsgData                    256A   Const
> D   MsgDtaLen                   10I 0 Const
> D   MsgType                     10A   Const
> D   CallStkEnt                  10A   Const
> D   CallStkCnt                  10I 0 Const
> D   MessageKey                   4A
> D   ErrorCode                32766A   options(*varsize)
>
> D dsEC            DS
> D  dsECBytesP             1      4I 0 inz(0)
> D  dsECBytesA             5      8I 0 inz(0)
>
> D wwMsgKey        S              4A
> D wwText          s            100A   varying
>
> c                   eval      Bytes = Bytes + peLen
> c                   eval      wwText = %trim(%editc(Bytes:'P')) +
> c                                ' bytes received'
>
> c                   if        peFd <> -1
> c                   if        write(peFd: peData: peLen) < 1
> c                   return    -1
> c                   endif
> c                   else
> c                   eval      rcvDta = rcvDta +
> c                                      %subst(peDta: 1: peLen)
> c                   endif
>
> c                   return    peLen
> P                 E



On Thu, Oct 27, 2016 at 7:13 AM, John Long <John.Long@xxxxxxxxxxxxxx> wrote:

>    Hi All,
>
>
>    I need to receive a CSV file that is generated when I issue  a HTTP
>    GET,  I know I can use http_url_get specifying the URL and file name in
>    the IFS,
>
>
>    Is there a way that I can get the file straight into memory and
>    manipulate it there rather than having it automatically stored in the
>    IFS and then accessing from there?
>
>
>    Thanks in advance
>
>
>    John
>
>
>
>
>    _____________________________________________________________ T.J.
>    MORRIS LTD-CONFIDENTIALITY NOTICE This e-mail and its contents,
>    together with any attachments, are confidential to the sender and the
>    intended recipient(s). If you are not the intended recipient or agent
>    responsible for delivery to the intended recipient any unauthorised
>    storage, use, disclosure, copying, distribution or dissemination of
>    this e-mail or any part thereof is strictly prohibited and may be
>    illegal. If you receive this e-mail in error please advise us by
>    telephone on +44(0)151 530 2920 and delete and destroy this e-mail and
>    any attachments and any copies thereof from your system immediately.
>    Any views or opinions expressed in this e-mail are solely those of the
>    sender and do not necessarily represent those of T J Morris Ltd.
>    Although any attachments to this e-mail have been checked for viruses
>    we make no representation and give no warranty as to the absence of
>    viruses and you should scan this e-mail and attachments for viruses.
>    ___________________________________________________________
>
> ----------------------------------------------------------------------
> - This is the FTPAPI mailing list.  To unsubscribe, please go to:
> http://www.scottklement.com/mailman/listinfo/ftpapi
> ----------------------------------------------------------------------
> -
>
>


--
Chris Edmondson
509.670.6817
_____________________________________________________________ T.J. MORRIS LTD-CONFIDENTIALITY NOTICE This e-mail and its contents, together with any attachments, are confidential to the sender and the intended recipient(s). If you are not the intended recipient or agent responsible for delivery to the intended recipient any unauthorised storage, use, disclosure, copying, distribution or dissemination of this e-mail or any part thereof is strictly prohibited and may be illegal. If you receive this e-mail in error please advise us by telephone on +44(0)151 530 2920 and delete and destroy this e-mail and any attachments and any copies thereof from your system immediately. Any views or opinions expressed in this e-mail are solely those of the sender and do not necessarily represent those of T J Morris Ltd. Although any attachments to this e-mail have been checked for viruses we make no representation and give no warranty as to the absence of viruses and you should scan this e-mail and attachments for viruses. ___________________________________________________________
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------