Hi Scott,
First of thanks for the example of how to get this to work. It works
great.
I wanted to take a few days to try and digest/understand you were
telling me. I don't do this sort of thing often, so I just tried to
make use of one of my current programs and force it work.

Your last statement about the first & character was spot on as that is
exactly what was happening.

It will probably be another year(or more) before I do anything like this
again, so I'll probably have to reread the difference between POST and
GET then.

Anyway Thanks again.

Mike

-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Scott Klement
Sent: Wednesday, June 15, 2011 5:46 PM
To: Midrange Systems Technical Discussion
Subject: Re: Httpapi and tinyurl

Hello,

I'm really amazed that you're getting back anything..? Your code
doesn't make any sense.

You are appending ?url= to the URL of the site you're connecting to.
This normally would be done in order to encode data supplied to a
program via the HTTP GET method, since there's no other way to transmit
data in HTTP GET.

But, then you're sending the actual URL that you want to encode in POST
data! Huh? That makes no sense.

If the API supports post, then the whole thing (url=whatever) should be
in the POST data. If not, you should be using the GET method and sending
the whole request in the URL, as is normal with the GET method.

Plus, you aren't URL encoding any of it. Won't that wreck havoc as soon
as you hit the first & character in the URL?



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 have experimented with building a .bat file before but I don't like
that solution, so I thought about using TINYURL to return a shorter
link
that I can call.

So do to that I thought I would use Scotts HTTPAPI stuff.

I have this mostly working, but I'm not getting the correct link back
from tinyurl.

So I have this

'http://rgc-filenexus/FileNexus/BrowserClient/directlink.aspx?fid=58&cid
=32&iid=23&iv=100377101'

I expect to get back this from TinyUrl
http://tinyurl.com/3ohj5m4

Instead I'm getting
http://tinyurl.com/3o7lzto

Which translates to this

'http://rgc-filenexus/FileNexus/BrowserClient/directlink.aspx?fid=58'

I have been through the program and I don't see anywhere where I'm
truncating anything. Any idea why this is happening?


Basics of the code are below

C Eval URL =
'http://rgc-filenexus/FileNexus/+
C BrowserClient/directlink.aspx?+
C fid=58&cid=32&iid=23&iv=100377101'

C** The only diff between using HTTPwserClientg HTTP is
C** the URL that we pass. It starts with 'https://'
C Eval PostURL = 'http://tinyurl.com/api-+
C create.php?url='
C Eval PostData = URL
C
C callp HTTP_SetFileCCSID(819)
C Eval rc = http_url_post(%trim(PostURL) +
C %trim(postdata)
C : mypointer
C : %len(PostData)
C : logfile
C : HTTP_TIMEOUT
C : HTTP_USERAGENT)

This thread ...

Replies:

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