CGI? Question - IBM AS400

This is a discussion on CGI? Question - IBM AS400 ; Is it possible to read the csv answer using google for geocoding adresses ? eg.the answer to: strpccmd 'iexplore http://maps.google.com/maps/geo?q=16...sv&key=abcdefg ' Regards, Martin...

+ Reply to Thread
Results 1 to 8 of 8

Thread: CGI? Question

  1. CGI? Question

    Is it possible to read the csv answer using google for geocoding
    adresses ?

    eg.the answer to:

    strpccmd 'iexplore
    http://maps.google.com/maps/geo?q=16...sv&key=abcdefg'

    Regards, Martin

  2. Re: CGI? Question

    On Sep 9, 5:41*pm, Martin Hinze wrote:
    > Is it possible to read the csv answer using google for geocoding
    > adresses ?
    >
    > eg.the answer to:
    >
    > strpccmd 'iexplorehttp://maps.google.com/maps/geo?q=1600+Amphitheatre+Parkway,+Mountain...
    >
    > Regards, Martin


    You need to use a program like wget to save the resulting data to a
    file on the pc. You might be able to do this with iexplore using some
    vbscript - see the helptext for iexplore....Then process that with
    some other program.

    Jonathan.

  3. Re: CGI? Question

    Google is acting much like a web-service here, so something written in
    RPG + CGI, or Java, should be able to issue the HTTP request and read
    the response natively on the AS400.

  4. Re: CGI? Question

    being familiar to CGIDEV2, putting the HTTP request with the
    AS400 is not the problem but reading/getting the result is.

    Regards, Martin

  5. Re: CGI? Question

    Sorry - I could help you out with doing this in Java, but I'm not an
    RPG guy. Does Scott Klement's HTTP API for RPG help?:
    http://www.scottklement.com/httpapi/

  6. Re: CGI? Question

    Martin,

    With HTTPAPI it is pretty easy to exchange data with a web server. It is free and a great utility. The
    following code snipped shows how to get the geocoding addresses from Google. Please notice that
    'g_data' is a global defined field:

    *
    *================================================= ==============*
    * Main procedure
    *================================================= ==============*
    P main...
    P B
    *
    D main...
    D PI
    *
    D rc S 10I 0 inz
    * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    /FREE

    clear g_data; // clear global helper field, contains the HTTP response data
    http_setProxy('yourProxyServer': 8080); // set proxy server
    rc = http_url_get_raw('http://maps.google.com/maps/geo?+
    q=1600+Amphitheatre+Parkway,+Mountain+View,+
    +CA&output=csv&key=abcdefg'
    : 0
    : %paddr('receiveResponse'));
    return;

    /END-FREE
    *
    P main...
    P E
    *
    *================================================= ==============*
    * Procedure that receives the HTTP response.
    *================================================= ==============*
    P receiveResponse...
    P B
    *
    D receiveResponse...
    D PI 10I 0
    D fd 10I 0 value
    D data * value
    D length 10I 0 value
    *
    D tmpBuffer S 65535A based(pTmpBuffer)
    * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    /FREE

    B01 if (length > 0);
    HTTP_xlatedyn(length: data: TO_EBCDIC: pTmpBuffer);
    g_data = %subst(tmpBuffer: 1: length);
    dealloc(N) pTmpBuffer;
    E01 endif;

    return length;

    /END-FREE
    *
    P receiveResponse...
    P E
    *

    Regards,

    Thomas.



    Martin Hinze schrieb:
    > Is it possible to read the csv answer using google for geocoding adresses ?
    >
    > eg.the answer to:
    >
    > strpccmd 'iexplore
    > http://maps.google.com/maps/geo?q=16...sv&key=abcdefg'
    >
    >
    > Regards, Martin


  7. Re: CGI? Question

    The following line ...

    HTTP_xlatedyn(length: data: TO_EBCDIC: pTmpBuffer);

    .... should be changed to:

    length = HTTP_xlatedyn(length: data: TO_EBCDIC: pTmpBuffer);

    Thomas.

    Thomas Raddatz schrieb:
    > Martin,
    >
    > With HTTPAPI it is pretty easy to exchange data with a web server. It is
    > free and a great utility. The following code snipped shows how to get
    > the geocoding addresses from Google. Please notice that 'g_data' is a
    > global defined field:
    >
    > *
    > *================================================= ==============*
    > * Main procedure
    > *================================================= ==============*
    > P main...
    > P B
    > *
    > D main...
    > D PI
    > *
    > D rc S 10I 0 inz
    > * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    > /FREE
    >
    > clear g_data; // clear global helper field, contains the HTTP
    > response data
    > http_setProxy('yourProxyServer': 8080); // set proxy server
    > rc = http_url_get_raw('http://maps.google.com/maps/geo?+
    >
    > q=1600+Amphitheatre+Parkway,+Mountain+View,+
    > +CA&output=csv&key=abcdefg'
    > : 0
    > : %paddr('receiveResponse'));
    > return;
    >
    > /END-FREE
    > *
    > P main...
    > P E
    > *
    > *================================================= ==============*
    > * Procedure that receives the HTTP response.
    > *================================================= ==============*
    > P receiveResponse...
    > P B
    > *
    > D receiveResponse...
    > D PI 10I 0
    > D fd 10I 0 value
    > D data * value
    > D length 10I 0 value
    > *
    > D tmpBuffer S 65535A based(pTmpBuffer)
    > * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    > /FREE
    >
    > B01 if (length > 0);
    > HTTP_xlatedyn(length: data: TO_EBCDIC: pTmpBuffer);
    > g_data = %subst(tmpBuffer: 1: length);
    > dealloc(N) pTmpBuffer;
    > E01 endif;
    >
    > return length;
    >
    > /END-FREE
    > *
    > P receiveResponse...
    > P E
    > *
    >
    > Regards,
    >
    > Thomas.
    >
    >
    >
    > Martin Hinze schrieb:
    >> Is it possible to read the csv answer using google for geocoding
    >> adresses ?
    >>
    >> eg.the answer to:
    >>
    >> strpccmd 'iexplore
    >> http://maps.google.com/maps/geo?q=16...sv&key=abcdefg'
    >>
    >>
    >> Regards, Martin


  8. Re: CGI? Question

    Martin Hinze wrote:
    > Is it possible to read the csv answer using google for geocoding adresses ?
    >
    > eg.the answer to:
    >
    > strpccmd 'iexplore
    > http://maps.google.com/maps/geo?q=16...sv&key=abcdefg'
    >
    >
    > Regards, Martin


    My GETURI application will do this, either in a command or in a program
    call. Here's an example command you'd use:

    GETURI URI('http://maps.google.com/maps/geo')
    DATA('q=1600+Amphitheatre+Parkway,+Mountain+View,+ CA&output=csv&key=abcdefg')

    Then you could also set it up to store the result in a stream file, a
    physical file, or have it returned to the screen.

    With the API interface for GETURI, you can do all of the above, and have
    the option of having the data returned to your program in a parameter of
    the call.

    You can download a trial from www.bvstools.com/geturi.html. As always,
    feel free to contact me with questions.




    Brad
    www.bvstools.com

+ Reply to Thread