hi Mike,

On 6/15/2011 3:26 PM, Smith, Mike wrote:
I have a project where I need to call a url(that accesses our document
management system) from within an RPG program.

I did some searching, but couldn't find any docs for the "api-create" tool at tinyurl... I found lots of 3rd party tips referencing it, but nothing official from TinyURL. But, from experimenting, it seems to be using the GET method, not POST.

Here's an example of how I would code that (but I'm not familiar with all of your requirements, so I may be doing something wrong.. hopefully you can adapt it):


/define WEBFORMS
/copy httpapi_h

D raw_receiver PR 10i 0
D fd 10i 0 value
D data 65535a options(*varsize)
D len 10i 0 value

D rc s 10i 0
D form s like(WEBFORM)
D Url s 500a varying
D LongVersion s 256a
D ShortVersion s 50a varying

LongVersion = 'http://rgc-filenexus/FileNexus/+

// encode the data the way a browser would
// if entered into an HTML form:

form = WEBFORM_open();
WEBFORM_setVar( form: 'url': %trimr(LongVersion) );
url = 'http://tinyurl.com/api-create.php?'
+ WEBFORM_getData(form);

// Send with GET method:
// (note: I'm using get_raw so I don't have to
// save to/from disk)

ShortVersion = '';

rc = http_url_get_raw( url
: -1
: %paddr(raw_receiver) );

if (rc <> 1);

// This is just for demo purposes.
dsply ShortVersion;

*inlr = *on;

* raw_receiver: This receives raw HTTP data as it arrives
* from the network.
P raw_receiver B
D PI 10i 0
D fd 10i 0 value
D data 65535a options(*varsize)
D len 10i 0 value
if (len > 0);
HTTP_xlate( len: data: TO_EBCDIC );
ShortVersion += %subst(data:1:len);
return len;

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].