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

Re: Need simple request help.



Mike,

Did you miss the sample code that I posted?
http://www.scottklement.com/archives/ftpapi/200707/msg00037.html

You're saying things like "Scott will point you in the right direction" 
and I thought I already did??

Mike Krebs wrote:
> John,
> 
> This is not exactly what you wanted, but get this working and then go from
> there. I think you will have to look at http_url_get_raw (example9), but
> Scott will point you in the right direction. See if you can compile this
> program. Notice I "hardcoded" the URL encoding. This is needed in the simple
> examples, but the encoder can be called directly when you get that far.
> 
> Then run it. It should display the file to the screen.
> 
> Mike
> 
> 
> H DFTACTGRP(*NO) ACTGRP(*NEW) BNDDIR('HTTPAPI')                            
>                                                                            
>  *                                                                         
>  * The simplest thing that HTTPAPI can do is download a                    
>  * file from a web server.  This example demonstrates                      
>  * retrieving a geocoded address from a web service                        
>  *                                                                         
>  *                                                                         
>                                                                            
> D/copy qrpglesrc,httpapi_h                                                 
> D cmd             pr                  extpgm('QCMDEXC')                    
> D  command                     200A   const                                
> D  length                       15P 5 const                                
>                                                                            
> D rc              s             10I 0                                      
> D msg             s             52A                                        
>                                                                            
> c                   callp     http_debug(*ON)                              
>                                                                            
> C* Retrieve geocoding information                                          
>                                                                            
> c                   eval      rc = http_url_get(                           
> c                             'HTTP://rpc.geocoder.us/service/'+           
> c                             'csv?address=' +                             
> c                             '1600%20Pennsylvania%20Avenue%20NW,%20' +    
> c                             'Washington,DC':                             
> c                             '/tmp/geocode.csv')                          
>                                                                            
> c                   if        rc <> 1                                      
> c                   eval      msg = http_error                             
> c     'Error'       dsply                                                  
> c**  'msg' now contains an error message that you can                      
> c**  display to the user.                                                  
> c                   else                                                   
> c                   callp     cmd('DSPF ''/tmp/geocode.csv''': 200)        
> c                   endif                                                  
>                                                                            
> c                   eval      *inlr = *on
> 
>                                   
> 
> -----Original Message-----
> From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of John Buying
> Sent: Friday, July 13, 2007 9:50 AM
> To: HTTPAPI and FTPAPI Projects
> Subject: Need simple request help.
> 
>  Greetings,
> So I am trying to work with geo coding. Yes I will need to create a mashup
> of all the local pizza places in RPG.  Now this is some task.
>  
> My first step is to geo code all the places.  I have found a www site that
> will return the lat and lon for an address.  
>  
> I downloaded the HTTPAPI and looked through the examples.
>  
> This is a very simple www service.  I don't need to load a file, put data
> into a physical or save information to the IFS.  I just need to make the
> call and get the data back in memory.  I like the currency example.  But am
> at a loss as to how to convert it so that it would work for me.  This also
> might not even be the best example to use.
>  
> If your address was lets say the white house I would put in
> http://rpc.geocoder.us/service/csv?address=1600 Pennsylvania Avenue NW,
> Washington,DC
>  
> and the server would return to me 38.898748,-77.037684,1600 Pennsylvania Ave
> NW,Washington,DC,20502  You could change the address to get your code.  
>  
> So which would be the best example for me to work with so that I could make
> the call and get back the coding?
>  
>  
> As a side note....
> I have tried to use the amazon example, but the link to get an account seems
> to be broken.  I have then found it and signed up.  I put in my key and it
> still failed.
>  
>  
> This is my first venture into this crazy world.  I know this might seem easy
> to you, but I have to take a few baby steps first.  
>  
> tia,
> John
>  
>  
> -----------------------------------------------------------------------
> This is the FTPAPI mailing list.  To unsubscribe, please go to:
> http://www.scottklement.com/mailman/listinfo/ftpapi
> -----------------------------------------------------------------------
> 
> -----------------------------------------------------------------------
> This is the FTPAPI mailing list.  To unsubscribe, please go to:
> http://www.scottklement.com/mailman/listinfo/ftpapi
> -----------------------------------------------------------------------

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