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

RE: Simple HTTP request.



Sound like you are using a GET so EXAMPLE1 will do. If you have to parse the response, then it does get a bit more complicated.

But if you have HTTPAPI from the last couple of years, you can use the command HTTPAPI. Something like this maybe...

LIBHTTP/HTTPAPI URL('http://server.com/nameoffile.txt') DOWNLOAD('/tmp/nameoffile.txt') DEBUG('/tmp/debug/nameoffile.txt')

The response would be in /tmp/nameoffile.txt and you could use a QSH command to check it. I put "OK" in nameoffile.txt. Something like:

strqsh cmd('grep BB /tmp/nameoffile.txt') 
Command ended normally with exit status 1.
strqsh cmd('grep OK /tmp/nameoffile.txt') 
Command ended normally with exit status 0.

This thread shows how to avoid the "press Enter" screen and retrieve the exit status:
http://www.code400.com/forum/showthread.php/6924-QSH-Error-Trapping


-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Versfelt, Charles
Sent: Wednesday, November 07, 2012 8:45 AM
To: HTTPAPI and FTPAPI Projects
Subject: Simple HTTP request.

I hate to turn to the experts on something simple, but I need to get this done quickly.  I've used HTTPAPI only once, to post an XML request to another server.  Now, I want to do something simpler, but I'm not sure how.

All I need to do is run a simple HTTP request from an RPG (or CL) program, accept a response and exit.  

Our network/web programmer created a URL that, when clicked on, converts a file (named in the URL) in a folder to a different format and drops it in another folder.  It returns either OK or an error.

The URL is always the same, only the name of the file changes and would be loaded by my RPG.

What's the simplest way to do that?   I'm looking through the examples in LIBHTTP and nothing's jumping out at me.  

Thanks,
Charlie

This email message has been delivered safely and archived online by Mimecast.  For more information please visit http://www.mimecast.com

-----------------------------------------------------------------------
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
-----------------------------------------------------------------------