[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: trying to grab a web page and write to IFS on iseries
Hi Joel,
>
> Havent used HTTPAPI before. Have LIBHTTP10 (version 10).
>
HTTPAPI comes, by default, in a library named LIBHTTP. If you have a
library named 'LIBHTTP10', then that's a name that you or someone else
in your shop decided upon. That name doesn't tell me anything.
HTTPAPI's current version is 1.24. There has never been a version "10",
but perhaps you mean 1.10? If so, your copy is outrageously out of
date, and unsupported.
> When I run, it displays
>
> call test1
>
> DSPLY HTTP/1.1 302 Found
302 is a redirect. The web site is trying to tell you that you need to
try your request on a different URL.
You can retrieve that URL by calling http_redir_loc(). It will return
the URL that the site is asking you to redirect to. You can then call
http_url_get() again on the new URL.
So...
rc = http_url_get( 'original URL': IfsFile) ;
if rc = 302;
newurl = http_redir_loc();
rc = http_url_get( newurl : IfsFile );
endif;
if rc <> 1;
http_crash();
endif;
I don't remember exactly which release introduced each of these
features, so if one of them doesn't work on your release of HTTPAPI
(which, again, I'm assuming is 1.10, for lack of more information) then
you'll need to update.
>
> Also, is there a command interface so I can do something like:
>
>
> GETWEBPAGE URL([1]www.yahoo.com) IFSFILE(tmp/filedownload)
>
If you update to HTTPAPI version 1.24, there is indeed a command-line
interface (available both as a CL command and as a QShell command)
From the CL interface:
HTTPAPI URL('http://www.yahoo.com') +
DOWNLOAD('/tmp/filedownload.html')
From the QShell interface:
$ httpapi get --download=/tmp/filedownload.html http://www.yahoo.com
One nice thing about the command-line interface (either one) is that
they'll handle the 302 redirect for you automatically (unless you ask
them not to, via the REDIRECT parameter)
Hope that helps.
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------