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

RE: Ftpapi Digest, Vol 13, Issue 25



Thanks Elbert.

Will do perfect!!!
------------------------------

Message: 3
Date: Fri, 20 Jul 2007 11:50:09 -0400
From: "Elbert Cook" <elbert@xxxxxxxxxxxxxxx>
Subject: Re: USPS socket example
To: "HTTPAPI and FTPAPI Projects" <ftpapi@xxxxxxxxxxxxxxxxxxxxxx>
Message-ID: <002d01c7cae5$a74b4d00$040fa8c0@Laptop1>
Content-Type: text/plain; format=flowed; charset="iso-8859-1";
	reply-type=original

I wrote this little program the other day to test looking up a zip code from

their test server.

You can probably use it with a few changes.

H DFTACTGRP(*NO) ACTGRP(*CALLER) BNDDIR('HTTPAPI')
 **********************************************************************
D/copy LIBHTTP/qrpglesrc,httpapi_h
 *
D cmd             pr                  extpgm('QCMDEXC')
D  command                     200a   const
D  length                       15p 5 const
 *
D rc              s             10i 0
D Url             s            256a
D enc             s                   like(HTTP_URL_ENCODER)
 **********************************************************************
 /Free

   http_debug(*on);

   enc = http_url_encoder_new();

   http_url_encoder_addvar_s( enc:
                             'API': 'CityStateLookup');

   http_url_encoder_addvar_s( enc:
                             'XML':
         '<CityStateLookupRequest USERID="xxxxxxxxxxx">+
             <ZipCode ID="0">+
                <Zip5>20770</Zip5>+
             </ZipCode>+
          </CityStateLookupRequest>');

  Url = 'http://testing.shippingapis.com/ShippingAPITest.dll?'
        + http_url_encoder_getstr(enc);

  http_url_encoder_free(enc);

  rc = http_url_get(Url: '/tmp/USPStest.csv');

  cmd('DSPF ''/tmp/USPStest.csv''': 200);

  *inLR = *on;

/End-Free


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