PDA

View Full Version : Setupbuilder Get HTTP



NewsArchive
06-18-2017, 02:11 PM
Can I get a http page?
Ive tested with Chck Http:
http://www.armisoftware.com/portit/portitwintest.php?echo=0&ns=14624-886-6738604-61711&ip=&data=1&vw=%2010,1,0,2476
And I retreive a number but a text
Thanks

--
*Alberto Michelis*
ARMi software solutions www.armisoftware.com <http://www.armisoftware.com>

NewsArchive
06-18-2017, 02:25 PM
Alberto,

as far as I can see, this is not really a "downloadable" page or file.

http://www.armisoftware.com/portit/portitwintest.php?echo=0&ns=14624-886-6738604-61711&ip=&data=1&vw=%2010,1,0,2476

The .php seems to "do" something and then generates or redirects to a file
(portitwintest.htm)? So this can't work.

Perhaps what you are looking for is a POST HTTP command?

Friedrich

NewsArchive
06-18-2017, 02:26 PM
Similar to this (see attached screenshot). But your server returns "NS no
existe" so I think the parameters in my test POST for your PHP are not
correct.

Friedrich

NewsArchive
06-18-2017, 02:27 PM
Hi Friedrich,

Basically using the functions in WININET and without the error checking you...

!*** get handle to Internet ***
handleOpen = InternetOpen(address(cstrUserAgent), INTERNET_OPEN_TYPE_DIRECT, 0,0,0)
!*** get handle to File on Internet ***
handleFile = InternetOpenUrl(handleOpen, address(cstrURL), address(cstrNull), -1, INTERNET_FLAG_RELOAD, 0)
!*** pause for half a second ***
!*** without pause only part of the response seems to be gathered ***
sleep(500)
!*** read bytes into buffer ***
result = InternetReadFile(handleFile, address(cstrBuffer), 32000, address(bytesRead))
!*** clean up - closing all handles in reverse order ***
result = InternetCloseHandle(handleFile)
result = InternetCloseHandle(handleOpen)

Graham

NewsArchive
06-18-2017, 02:27 PM
Hi Graham,

SetupBuilder makes use of the core WINSOCK component (to lower the
"false-positive" rate to an absolute minimum). The installer does not use
WININET. But of course, Alberto can write his own small (WinINet) DLL and
call it from within SetupBuilder, absolutely no problem.

IMO, the preferred method to handle this task (send a request to the server,
let the server validate the serial number, etc. and send back a status code)
is the HTTP POST method. That's what most SetupBuilder users are doing.
The method can be used for serial number validation, maintenance code
validation, online maintenance extension, email message sending, etc.

Friedrich

NewsArchive
06-18-2017, 02:28 PM
....sorry Friedrich my response seems to not be attached to the correct
position in the thread - but it's there if you check.

MesNews attaches posts at the correct position but adds attachments as
'part1' 'part2' etc
Opera Mail handles attachments just fine, but screws up when it comes
ot positioning the responses :-(

Graham

NewsArchive
06-18-2017, 02:30 PM
Hi Alberton,

You can certainly do it using some of the functions in WININET.DLL

See attached project for Clarion 10 (converted from a Clarion 6.1 project
I posted in 2012 - so it'll work in any Clarion version)

Result is retrieved as a small XML file that you need to parse to get the
bits you want.

Ignore the GetLatLong project title as that was the original task
retrieving Latitude and Longitude from Google via a web address.

Graham

NewsArchive
06-18-2017, 02:32 PM
Hi Friedrich,

OK well can SetupBuilder use GET rather than POST?

If I load the Web page and check using Fiddler it's doing a GET and the
attached project uses the new ClaRunExt HTTP functions to GET the response.
Either as a file, or an XML string.

!*** next line should be all on one line ***
requestEndpoint =
'http://www.armisoftware.com/portit/portitwintest.php?echo=0&ns=14624-886-6738604-61711&ip=&data=1&vw=%2010,1,0,2476'
httpVerbMethod = HttpVerb:GET
requestParameters = 'format=xml'
postData = ''
responseOut = ''

retVal =
webReq.HttpWebRequest(requestEndpoint,httpVerbMeth od,postData,requestParameters,responseOut)

So if SetupBuilder can GET it should be OK yes?

Maybe I'm wrong but the address seems to be about grabbing stock market
quotes, seems a strange thing to want to do with SetupBuilder?

Graham

NewsArchive
06-18-2017, 02:32 PM
Hi Graham,

> OK well can SetupBuilder use GET rather than POST?

The "Download File (HTTP)..." script function in SetupBuilder uses the HTTP
GET command to retrieve a text or binary file, the "Post to HTTP Server..."
script function sends a HTTP POST request to the server (and can retrieve
the server response).

So both GET and POST are supported in SB.

Friedrich

NewsArchive
06-18-2017, 02:33 PM
This works fine :-)

Friedrich

NewsArchive
06-18-2017, 02:33 PM
Here is the working demo:

http://www.lindersoft.com/projects/Alberto_PostHTTP.zip

Please note the double %%

Friedrich

NewsArchive
06-19-2017, 09:39 AM
Thanks

*Alberto Michelis*
ARMi software solutions www.armisoftware.com <http://www.armisoftware.com>

NewsArchive
06-19-2017, 09:39 AM
Thanks Friedrich!
Now, as you can see, in the response there are a date between <fv> and
</fv>, how can I test this date to be grater than today()?
And how to retreive the name between <no> and </no>?
Thanks

*Alberto Michelis*
ARMi software solutions www.armisoftware.com <http://www.armisoftware.com>

NewsArchive
06-19-2017, 09:39 AM
Hi Alberto,

> Thanks Friedrich!
> Now, as you can see, in the response there are a date between <fv> and
> </fv>, how can I test this date to be grater than today()?
> And how to retreive the name between <no> and </no>?

I have developed a demo project for you:

http://www.lindersoft.com/projects/Alberto_PostHttp2.zip

See attached screenshots.

Does this help?

Friedrich

--
Friedrich Linder
Lindersoft | SetupBuilder | www.lindersoft.com
954.252.3910 (within US) | +1.954.252.3910 (outside US)

--SetupBuilder "point. click. ship"
--Helping You Build Better Installations
--Create Windows 10 ready installations in minutes
--Official COMODO Code Signing and SSL Certificate Partner

NewsArchive
06-19-2017, 09:40 AM
Thank you very much!!!
Regards

*Alberto Michelis*
ARMi software solutions www.armisoftware.com <http://www.armisoftware.com>