[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: I may have missed something ...
Scott, just forget it ... I wrote my own stuff ;-)
* HTTPAPI extension
d pHttpInz pr
d pHttpBufferBuild...
d pr 10i 0
d httpFD 10i 0 value
d httpAddr * value
d httpSize 10i 0 value
d pHttpAddr pr *
d pHttpSize pr 10i 0
d pHttpDecl s 1a inz(*off)
d pHttpBAddr s * inz(*null)
d pHttpBSize s 10i 0
pHttpInz();
rc = http_url_get_raw(url:fd:%paddr('PHTTPBUFFERBUILD'));
if (rc <> 1);
dsply 'HTTPAPI: An error occured in the call';
return;
endif;
xmlReaderInz(pHttpAddr:pHttpSize);
xmlReaderCase('L');
dow xmlReader = 0;
......
enddo;
xmlFree();
....
*====================================================================
=
* pHttpInz
*====================================================================
=
p pHttpInz b export
d pi
/free
pHttpDecl = *off;
dealloc pHttpBAddr;
pHttpBSize = 0;
/end-free
p e
*====================================================================
=
* pHttpBufferBuild
*====================================================================
=
p pHttpBufferBuild...
p b
d pi 10I 0
d httpFD 10I 0 value
d httpAddr * value
d httpSize 10I 0 value
d memcpy pr extproc('memcpy')
d dest * value
d src * value
d length 10u 0 value
d xlateAddr s *
d xlateSize s 10i 0
/free
if httpSize <= 0;
return httpSize;
endif;
if pHttpDecl = *off;
dealloc xlateAddr;
pHttpDecl = *on;
xlateAddr = %alloc(32767);
xlateSize = http_xlatedyn(httpSize:httpAddr:TO_EBCDIC:xlateAddr);
pHttpBSize = xlateSize;
pHttpBAddr = %alloc(pHttpBSize);
memcpy(pHttpBAddr+pHttpBSize-xlateSize:xlateAddr:xlateSize);
else;
xlateSize = http_xlatedyn(httpSize:httpAddr:TO_EBCDIC:xlateAddr);
pHttpBSize += xlateSize;
pHttpBAddr = %realloc(pHttpBAddr:pHttpBSize);
memcpy(pHttpBAddr+pHttpBSize-xlateSize:xlateAddr:xlateSize);
endif;
return httpSize;
/end-free
p e
*====================================================================
=
* pHttpAddr
*====================================================================
=
p pHttpAddr b export
d pi *
/free
return pHttpBAddr;
/end-free
p e
*====================================================================
=
* pHttpSize
*====================================================================
=
p pHttpSize b export
d pi 10i 0
/free
return pHttpBSize;
/end-free
p e
hr@xxxxxxxxxxxx
Sent by: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
06-05-2010 20:30
Please respond to
HTTPAPI and FTPAPI Projects <ftpapi@xxxxxxxxxxxxxxxxxxxxxx>
To
HTTPAPI and FTPAPI Projects <ftpapi@xxxxxxxxxxxxxxxxxxxxxx>
cc
Subject
I may have missed something ...
This is a little special ting, I'm trying to log into the an Iseries
Session on the same server I got the request from:
serverAddr = %trim(getExtEnvVar('SERVER_ADDR'));
serverPort = %trim(getExtEnvVar('SERVER_PORT'));
ts = %char(timeStamp());
iceCapUrl = 'HTTP://'
+ serverAddr
+ ':'
+ serverPort
+ '/icecap/login.asp?user='
+ %trim(user)
+ '&password='
+ password
+ '&ts='
+ ts;
filename = http_tempfile() + '.txt';
rc = http_url_get(iceCapUrl:filename);
I'm in the middle of basically a CGIDEV2 progtam and recieves back:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML><HEAD>
<TITLE>302 Found</TITLE>
</HEAD><BODY>
<H1>Found</H1>
<P>The document has moved <A
HREF="http://192.168.90.100:7050/login.asp?user=demo&password=demo
">here</A>.</P>
</body></html>
No problem, I just read the HTML document an make a recall ...
xmlFromStmf(filename);
xmlReaderInz(xmlAddr:xmlSize);
xmlReaderCase('L');
dow xmlReader = 0;
select;
when xmlGetNode = 'a' and xmlGetAttr = 'href';
redirectUrl = xmlGetData;
leave;
endsl;
enddo;
xmlFree();
filename = http_tempfile() + '.txt';
rc = http_url_get(redirectUrl:filename);
if (rc <> 1);
dsply 'HTTPAPI: An error occured in the iceCap call 2';
return;
endif;
BUT !!! is there anyway I just can retreive the http_url_get %addr and
%size,
so I dont have to store the result in a IFS file before reading it ?
Regards
Henrik
----------------------------------------------------------------------
-
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
-----------------------------------------------------------------------