Liam moc
2008-07-23 11:42:04 UTC
I've been using internetopenurl / internetreadfile to retrieve web pages
no problem however one page contains the following
/////entry near start of form
<script type="text/javascript"> <!--
vBulletin_Clock = new _vBulletin_Clock;
... more stuff ...
detail_loader = new Array();
--> </script>
///////later in the form are multiple instances of
<script type="text/javascript">
<!--detail_loader[detail_loader.length] = new Array('detail_load_8072',
'8072', 'Open Detail', '1', '1');-->
</script>
obviously each instance has different params. These are associated with
images(buttons) on the form and when clicked add a new frame of text to
the form. Note that this new text is not available within the source of
the the parent form.
So my question is how do I prepare a request to retreive this data?
Can I use InternetOpenUrl specifying the script and params in the
lpszHeaders param.
If so how do I format the string ?
Can I query the format of this header string from the site ?
Having searched around I came across and tried the following but I'm not
sure if I'm anywhere close to what i'm trying to achieve. I think I'm
tryin to get the required parameters format but ?!?!?
(coded In Delphi. All nullstring casting removed)
hInternetOpen := InternetOpen
('httpgeneric',INTERNET_OPEN_TYPE_PRECONFIG,nil,nil,0);
hInternetConnect := InternetConnect
(hInternetOpen,'http://www.forexfactory.com/',INTERNET_DEFAULT_HTTP_PORT
,nil,'HTTP/1.0',INTERNET_SERVICE_HTTP,0,0);
hHttpOpenRequest := HttpOpenRequest
(hInternetConnect,'POST','scripts/detail_loader.asp','HTTP/1.0',nil,0,IN
TERNET_FLAG_RELOAD,0);
sHeader := 'Content-Type: application/x-www-form-urlencoded'+#13#10;
bRet := HttpAddRequestHeaders(hHttpOpenRequest,sHeader, Length(sHeader),
HTTP_ADDREQ_FLAG_REPLACE Or HTTP_ADDREQ_FLAG_ADD);
///// bret returns true here ... so far so good ?
/// I Dont know what Im really requesting with the value in the sHeader
...... after here ive tried
bRet := HttpQueryInfo(hHttpOpenRequest,
HTTP_QUERY_RAW_HEADERS_CRLF,buf, maxl,tr);
/// hoping to get the param names returned but it returns false
...... ive also tried this just trying to pass the params
lpszPostData := 'detail_load_8072&8072&open detail&1&1';
lPostDataLen := Length(lpszPostData);
bRet := HttpSendRequest
(hHttpOpenRequest,nil,0,lpszPostData,lPostDataLen);
//// Returns false .. Am I close here ? Is it just a case of supplying
an lpszPostData in the correct format?
Im hoping after calling HttpSendRequest I can use InternetReadFile to
retrieve the data i want to get at.
Any help here will be much apreciated
no problem however one page contains the following
/////entry near start of form
<script type="text/javascript"> <!--
vBulletin_Clock = new _vBulletin_Clock;
... more stuff ...
detail_loader = new Array();
--> </script>
///////later in the form are multiple instances of
<script type="text/javascript">
<!--detail_loader[detail_loader.length] = new Array('detail_load_8072',
'8072', 'Open Detail', '1', '1');-->
</script>
obviously each instance has different params. These are associated with
images(buttons) on the form and when clicked add a new frame of text to
the form. Note that this new text is not available within the source of
the the parent form.
So my question is how do I prepare a request to retreive this data?
Can I use InternetOpenUrl specifying the script and params in the
lpszHeaders param.
If so how do I format the string ?
Can I query the format of this header string from the site ?
Having searched around I came across and tried the following but I'm not
sure if I'm anywhere close to what i'm trying to achieve. I think I'm
tryin to get the required parameters format but ?!?!?
(coded In Delphi. All nullstring casting removed)
hInternetOpen := InternetOpen
('httpgeneric',INTERNET_OPEN_TYPE_PRECONFIG,nil,nil,0);
hInternetConnect := InternetConnect
(hInternetOpen,'http://www.forexfactory.com/',INTERNET_DEFAULT_HTTP_PORT
,nil,'HTTP/1.0',INTERNET_SERVICE_HTTP,0,0);
hHttpOpenRequest := HttpOpenRequest
(hInternetConnect,'POST','scripts/detail_loader.asp','HTTP/1.0',nil,0,IN
TERNET_FLAG_RELOAD,0);
sHeader := 'Content-Type: application/x-www-form-urlencoded'+#13#10;
bRet := HttpAddRequestHeaders(hHttpOpenRequest,sHeader, Length(sHeader),
HTTP_ADDREQ_FLAG_REPLACE Or HTTP_ADDREQ_FLAG_ADD);
///// bret returns true here ... so far so good ?
/// I Dont know what Im really requesting with the value in the sHeader
...... after here ive tried
bRet := HttpQueryInfo(hHttpOpenRequest,
HTTP_QUERY_RAW_HEADERS_CRLF,buf, maxl,tr);
/// hoping to get the param names returned but it returns false
...... ive also tried this just trying to pass the params
lpszPostData := 'detail_load_8072&8072&open detail&1&1';
lPostDataLen := Length(lpszPostData);
bRet := HttpSendRequest
(hHttpOpenRequest,nil,0,lpszPostData,lPostDataLen);
//// Returns false .. Am I close here ? Is it just a case of supplying
an lpszPostData in the correct format?
Im hoping after calling HttpSendRequest I can use InternetReadFile to
retrieve the data i want to get at.
Any help here will be much apreciated