Retrieving a web page via shell.explorer
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Davide,
>
Some of the properties I sent you this morning allows even to be changed directly inside the ActiveX control. This way you could even change the appearance of your page locally, allowing you to use your web server as a "template" for your local application (now it's time to be really excited ).
>
Thats exactly how I browse the images in my demo
I modify the InnerHTML on the fly
>
Some of the properties I sent you this morning allows even to be changed directly inside the ActiveX control. This way you could even change the appearance of your page locally, allowing you to use your web server as a "template" for your local application (now it's time to be really excited ).
>
Thats exactly how I browse the images in my demo
I modify the InnerHTML on the fly
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Very useful documentation links, thanks to Davide:
"Shell.Explorer" document object:
http://msdn.microsoft.com/en-us/library ... S.85).aspx
Navigate2 method:
http://msdn.microsoft.com/en-us/library ... S.85).aspx
"Shell.Explorer" document object:
http://msdn.microsoft.com/en-us/library ... S.85).aspx
Navigate2 method:
http://msdn.microsoft.com/en-us/library ... S.85).aspx
Main problem here is how to translate a string like "user=username&password=mypwd" into a ByteArray (please see sub PackBytes() at http://support.microsoft.com/kb/167658) in order to do:Antonio Linares wrote: Navigate2 method:
http://msdn.microsoft.com/en-us/library ... S.85).aspx
oActiveX:Do( "Navigate2", cURL, , , vPostData, "Content-Type: application/x-www-form-urlencoded"+CRLF)
Once this is solved we can post data to a script on a server (any script on the internet) and retrieve the dynamically generated page directly in the oActiveX object.
Hi,
Davide
- Patrick Mast
- Posts: 244
- Joined: Sat Mar 03, 2007 8:42 pm
Now we are talking!Davide wrote:Main problem here is how to translate a string like "user=username&password=mypwd" into a ByteArray (please see sub PackBytes() at http://support.microsoft.com/kb/167658) in order to do:Antonio Linares wrote: Navigate2 method:
http://msdn.microsoft.com/en-us/library ... S.85).aspx
oActiveX:Do( "Navigate2", cURL, , , vPostData, "Content-Type: application/x-www-form-urlencoded"+CRLF)
Once this is solved we can post data to a script on a server (any script on the internet) and retrieve the dynamically generated page directly in the oActiveX object.
Hi,
Davide
Patrick
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Davide,
Here you have it. Lets try it
I am calling CreateObject() so the OLE engine is properly initialized. Not needed once we use the ActiveX. Here it seems to work fine, at least there are no GPFs and it is returning a string.
test.prg
Here you have it. Lets try it
I am calling CreateObject() so the OLE engine is properly initialized. Not needed once we use the ActiveX. Here it seems to work fine, at least there are no GPFs and it is returning a string.
test.prg
Code: Select all
#include "FiveWin.ch"
function Main()
local oExplorer := CreateObject( "shell.explorer" )
MsgInfo( GetPostData( "user=username&password=mypwd" ) )
return nil
#pragma BEGINDUMP
#include <hbapi.h>
#include <windows.h>
HRESULT hb_oleVariantToItem( PHB_ITEM pItem, VARIANT * pVariant );
HB_FUNC( GETPOSTDATA )
{
VARIANT vPostData = {0};
LPSAFEARRAY psa;
LPCTSTR cszPostData = hb_parc( 1 );
UINT cElems = lstrlen( cszPostData );
LPSTR pPostData;
VariantInit( &vPostData );
psa = SafeArrayCreateVector( VT_UI1, 0, cElems );
if( ! psa )
{
hb_retnl( E_OUTOFMEMORY );
return;
}
SafeArrayAccessData( psa, ( LPVOID * ) &pPostData );
memcpy( pPostData, cszPostData, cElems );
SafeArrayUnaccessData( psa );
V_VT( &vPostData ) = VT_ARRAY | VT_UI1;
V_ARRAY( &vPostData ) = psa;
hb_oleVariantToItem( hb_param( -1, HB_IT_ANY ), &vPostData );
}
#pragma ENDDUMP
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- Patrick Mast
- Posts: 244
- Joined: Sat Mar 03, 2007 8:42 pm
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Patrick,
Please provide me a php from a https site, like this:
https://www.test.com/test.php // or from a subdomain, doesn't matter
and tell me what values to post, and display them from your php, and I will build the test in a moment
Please provide me a php from a https site, like this:
https://www.test.com/test.php // or from a subdomain, doesn't matter
and tell me what values to post, and display them from your php, and I will build the test in a moment
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
In example:
test.php
test.php
Code: Select all
<? echo "This is a test\n"; ?>
<? echo $HTTP_POST_VARS['first']; ?>
<? echo $HTTP_POST_VARS['last']; ?>
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- Patrick Mast
- Posts: 244
- Joined: Sat Mar 03, 2007 8:42 pm
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
This is the code:
test.prg
Here you can download the EXE:
http://rapidshare.com/files/142522826/test.zip.html
Besides the published GetPostData() source code, a modified Class TActiveX is required that will be included in next FWH build.
test.prg
Code: Select all
#include "FiveWin.ch"
function Main()
local oWnd, oActiveX
DEFINE WINDOW oWnd
@ 0, 0 ACTIVEX oActiveX PROGID "Shell.Explorer" OF oWnd
oWnd:oClient = oActiveX
ACTIVATE WINDOW oWnd ;
ON INIT oActiveX:Do( "Navigate2",;
"https://www.fivetechsoft.com/secure/english/test.php",,,;
GetPostData( "first=fivewin&last=FiveTech Software" ),;
"Content-Type: application/x-www-form-urlencoded" + CRLF )
return nil
http://rapidshare.com/files/142522826/test.zip.html
Besides the published GetPostData() source code, a modified Class TActiveX is required that will be included in next FWH build.
- Patrick Mast
- Posts: 244
- Joined: Sat Mar 03, 2007 8:42 pm