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

Re: [Ftpapi] Really simple use of HTTPAPI



Hi Jon and Bradley, i'm one of your articles/blogs fan by the way.

About your question below Jon, here is my sample rpg pgm for that, checking for invalid response from url-get and then redirect ...

+++++
0116.00    rc = http_req( 'GET'                                  
0117.00                 : 'https://your-url.com/blah-blah'      
0119.00                 : '/tmp/dandreb.html'        // resp-fil  
0120.00                 : *omit                                 // resp-str  
0121.00                 : *omit                                // req-fil  
0122.00                 : formData );                     // req-str  
0123.00                                                          
0132.00    // redirect resp                                      
0133.00    if rc=302;                                            
0134.00       rc = http_req( 'GET'                                
0135.00                    : http_redir_loc()                    
0136.00                    : '/tmp/dandreb302.html' );          
0137.00    endif;                                                
0138.00                                                          
0144.00    if rc <> 1;                                            
0145.00       msg = http_error();                                
0146.00       dsply msg;                                          
0147.00    else;                                                  
0148.00       cmd('DSPF ''/tmp/dandreb.html''': 200);            
0149.00    endif;                                    
+++++

cheers,
Reynaldo Dandreb Medilla


From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx <ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx> on behalf of B Stone <bvstone@xxxxxxxxx>
Sent: Monday, 6 January 2020 11:59 PM
To: FTPAPI/HTTPAPI mailing list <ftpapi@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re: [Ftpapi] Really simple use of HTTPAPI
 
You should be able to grab the return status from the HTTP headers returned, if any...  I'm not sure where, in HTTPAPI but if it's anything like GETURI it's there as an option.

On Mon, Jan 6, 2020 at 5:46 PM Jon Paris <jon.paris@xxxxxxxxxxxxxx> wrote:
What I am trying to do is to use HTTPAPI to check if a file of URLs that I have are valid.  And if not valid detect any redirect or 404 type errors.

I could have sworn I had seen examples of this but can't find any.

http_get is the closest API I can see but I don't want the web page content - just the status and any redirect URLs etc.


Anyone got any example?


Jon
--
_______________________________________________
Ftpapi mailing list
Ftpapi@xxxxxxxxxxxxxxxxxxxxxx
http://scottklement.com/mailman/listinfo/ftpapi
-- 
_______________________________________________
Ftpapi mailing list
Ftpapi@xxxxxxxxxxxxxxxxxxxxxx
http://scottklement.com/mailman/listinfo/ftpapi