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

RE: HTTPAPI Click Button then Download File



This code is full of debugging stuff but have at it.
     H DFTACTGRP(*NO) BNDDIR('HTTPAPI')                     
      /define WEBFORMS                                      
     D/copy qrpglesrc,httpapi_h                             
                                                            
     D cmd             pr                  extpgm('QCMDEXC')
     D  command                     200A   const            
     D  length                       15P 5 const            
                                                            
     D CRLF            C                   CONST(x'0D25')   
     D rc              s             10I 0                  
     D msg             s             52A                    
                                                            
     D Form            s                   like(WEBFORM)    
     D fromAddr        s            100A   varying          
     D Subject         s            100A   varying          
     D Message         s           1000A   varying          
     D URL             s           1000A   varying          
     D myPointer       s               *                    
     D dataSize        s             10I 0                  
                                                            
       http_debug(*on);                                     
                                                            
       rc = http_url_get(                                   
     H DFTACTGRP(*NO) BNDDIR('HTTPAPI')                                       
      /define WEBFORMS                                                        
     D/copy qrpglesrc,httpapi_h                                               
                                                                              
     D cmd             pr                  extpgm('QCMDEXC')                  
     D  command                     200A   const                              
     D  length                       15P 5 const                              
                                                                              
     D CRLF            C                   CONST(x'0D25')                     
     D rc              s             10I 0                                    
     D msg             s             52A                                      
                                                                              
     D Form            s                   like(WEBFORM)                      
     D fromAddr        s            100A   varying                            
     D Subject         s            100A   varying                            
     D Message         s           1000A   varying                            
     D URL             s           1000A   varying                            
     D myPointer       s               *                                      
     D dataSize        s             10I 0                                    
                                                                              
       http_debug(*on);                                                       
                                                                              
       rc = http_url_get(                                                     
               'https://www.frbservices.org/EPaymentsDirectory/FedACHdir.txt':
               '/tmp/fedACHdir.txt' );                                        
                                                                              
       if rc = 302;                                                           
         rc = http_url_get(http_redir_loc: '/tmp/redir1.html');               
       endif;                                                                 
       Form = WEBFORM_open;                                                   
                                                                              
       WEBFORM_SetVar(Form: 'agreementValue': 'Agree');                       
                                                                              
       WEBFORM_postData( Form : myPointer : dataSize );                       
       url = 'https://www.frbservices.org/EPaymentsDirectory/submitAgreement';
       rc = http_url_post(                                                    
                 url                                                          
               : myPointer                                                    
               : dataSize                                                     
               : '/tmp/testpost.html'                                         
               : HTTP_TIMEOUT                                                 
               : HTTP_USERAGENT                                               
               : 'application/x-www-form-urlencoded' );                       
       WEBFORM_close(Form);                                                   
       if rc = 302;                                                           
       rc = http_url_get(                                                     
               'https://www.frbservices.org/EPaymentsDirectory/FedACHdir.txt':
               '/tmp/fedACHdir2.txt' );                                       
       endif;                                                                 
     c                   if        rc <> 1                                    
     c                   eval      msg = http_error                           
     c                   dsply                   msg                          
     c                   else                                                 
     c                   callp     cmd('DSPF ''/tmp/fedACHdir2.txt''': 200)   
     c                   endif                                                
                                                                              
                                                                              
     c                   eval      *inlr = *on 


-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Guetzkow, Bruce
Sent: Friday, March 20, 2015 10:49 AM
To: 'ftpapi@xxxxxxxxxxxxxxxxxxxxxx'
Subject: HTTPAPI Click Button then Download File

I'm trying to download the following file: https://www.frbservices.org/EPaymentsDirectory/FedACHdir.txt

When I do this in a browser I am redirected to https://www.frbservices.org/EPaymentsDirectory/agreement.html

That redirect requires me to click the "Agree" button (to their terms of service) before I can continue to the original URL. (This is a recent change as I had a program that was able to simply download the file that was working for several years.)

I would like to use HTTPAPI to simulate "clicking" the "Agree" button (because I do agree to their terms) and then download the file. I've tried several methods but haven't found the proper solution, so I'm hoping someone here can steer me in the right direction.

Here are some of the attributes from the page:

-          Form: name="acceptedForm" id="acceptedForm" action="submitAgreement" method="post"

-          Button: id=agree_terms_use name="agreementValue" type="submit" value="Agree"

I'm using V1.29 of HTTPAPI. Thanks for any help you can offer,

Bruce Guetzkow

***********************************************************************************
PERSONAL & CONFIDENTIAL. THE E-MAIL MESSAGE (INCLUDING ANY ATTACHMENTS) FROM THIS SENDER IS FOR THE SOLE USE OF THE INTENDED RECIPIENT(S) AND MAY CONTAIN CONFIDENTIAL AND PRIVILEGED INFORMATION. IF THE READER OF THIS MESSAGE IS NOT THE INTENDED RECIPIENT, YOU ARE HEREBY NOTIFIED THAT ANY DISSEMINATION, DISTRIBUTION, UNAUTHORIZED REVIEW, USE OR DISCLOSURE OF THIS E-MAIL IS PROHIBITED. 

IF YOU HAVE RECEIVED THIS COMMUNICATION IN ERROR, PLEASE IMMEDIATELY NOTIFY US, BY CONTACTING POSTMASTER@xxxxxxxxxxxxxxxxxx,  RETURNING THE ORIGINAL MESSAGE TO THE SENDER AND DELETING ANY COPIES FROM YOUR SYSTEM. THANK YOU. 


Scanned by the Clearswift SECURE Email Gateway.

***********************************************************************************

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