saurabhAggarwal
17th January 2005 06:14 UTC
Accessing internet url
Hi
During installtion I need to verify the serial number that is entered by the user at the server.
How can we file a HTTP GET through nsis scripts.
This I have to do when user hits next button of the serial
number page.
The serial number page that I am using here is my custom designed.
waiting for reply
saurabh
Takhir
17th January 2005 07:37 UTC
Program files/NSIS/contrib/nsisdl plugin
http://forums.winamp.com/showthread....0&pagenumber=2 InetLoad plug-in (better proxy support and some other options)
saurabhAggarwal
17th January 2005 07:56 UTC
hi
I didn't found any help in there!!!!
Let me make the problem very clear
In many installations, we need to enter a serial number something like this dfdf-234j-34k3-asdf
In my installer I have one custom page for entering the serial number. Currently the installer just enters the serial number entered by user in the registry. Now I need to make some changes in it. I need to first verify that serial number at the server and if the serial number is valid then only user will be allowed to proceed further.
Thanks
Takhir
17th January 2005 08:11 UTC
You can add serial number string as url parameter
http://.../Aggarwal.php?sn=bla-bla-bla
and check server reply. You also need server program to check sn. Server answer may be Yes or No (for example), plug-in creates file, you can open and read this file or just check it's size (2 or 3 bytes).
saurabhAggarwal
17th January 2005 09:23 UTC
and how I can fire this http get request
saurabhAggarwal
17th January 2005 09:24 UTC
please give me some code example. I am new in writing these .nsi scripts
Thanks
Takhir
17th January 2005 09:43 UTC
!define stSTAT '(i,&i2,&i2,&i2,&i2,&i2,&i2,i,i,i,i,i) i'
Function fileSize
System::Call '*${stSTAT} .r0' ; allocates memory for STAT struct and writes address to $0
System::Call 'msvcrt.dll::_stat(t "$EXEDIR\cnhecksn.txt", i r0) i .r1'
IntCmp $1 -1 exit
System::Call "*$0${stSTAT}(,,,,,,,,.r1,,,)"
exit:
System::Free $0 ; free allocated memory
FunctionEnd
Code for SN page LEAVE function
InetLoad::load /BANNER "Serial number check out" "Please wait" "http://www.india.com/checksn.php" "$EXEDIR\cnhecksn.txt"
Call fileSize
IntCmp $1 3 yesAnswer
...
If server answer is not "Yes" installer should go back to your SN page (but I never did this trick with LEAVE func.)
saurabhAggarwal
17th January 2005 10:28 UTC
If I use something like this
NSISdl::download /NOIEPROXY "https://192.168.55.100/groupm/main.cgi?SN=$4"
pop $R0
StrCmp $R0 "success" +3
MessageBox MB_OK "Operation failed: $R0"
Quit
Is this work?
I am not sure bcoz i don't have server side script ready to check it.
Takhir
17th January 2005 10:43 UTC
local_file definition also required (where to store server answer). This should work except some proxy configurations.
saurabhAggarwal
17th January 2005 11:30 UTC
I have used the following code but this is not working
1. NSISdl::download /NOIEPROXY "http://192..../cgi- bin/validate.cgi?sn=1111111111111111" "C:\tmp\abc.txt"
2. pop $R0
3. StrCmp $R0 "yes" +3
4. MessageBox MB_OK "Operation failed: $R0"
5. Quit
6. MessageBox MB_OK "$R0"
Messagebox of line 4 is popped up and the message is:
Operation failed: Server did not specify content length
any clue
Takhir
17th January 2005 11:44 UTC
NSISdl works woth http 1.0 only and requires this http header. InetLoad can work without this. ;)
saurabhAggarwal
18th January 2005 03:52 UTC
The text file created using line
NSISdl::download /NOIEPROXY "http://192..../cgi- bin/validate.cgi?sn=1111111111111111" "C:\tmp\abc.txt"
<form method="post" action="/cgi-bin/validate.cgi?sn=1111111111111111" enctype="multipart/form-data">
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US"><head><title>Validation Response</title>
</head><body><h4>YES</h4></body></html>
I need to read that YES (OR NO) between h4 tags. Is there any function in nsis scripting to check one string in other string
saurabhAggarwal
18th January 2005 09:19 UTC
hi
This is working now
thanks for ur cooperation
saurabhAggarwal
18th January 2005 09:23 UTC
do you know how can we add validations to textbox
Suppose I have a text box and I want that the serial number
is entered in the following format
####-####-####-####
hyphen are placed automatically.
these kind validations are there in visual basic.
If this is not possible then is it possible to add event to key press at a text so as to set focus on another textbox