|
|
#1 |
|
Junior Member
Join Date: Jan 2009
Location: Paris
Posts: 5
|
[PROBLEM] How To Check URL ?
Hi,
I'm trying to check an URL like http://mysite.com/program1.6.exe If URL exist, the program is up to date. But if not, the installation have to close and launch the URL. I don't want a special download way... An IE download will be enough for me. Now, how can I realise that ? :$ I'm already checking if the program is installed or not with : But how can I do the same with an simple URL ?code: Thanks ! ThiWeb |
|
|
|
|
|
#2 |
|
Major Dude
Join Date: Jun 2001
Posts: 1,173
|
could try the Inetc plugin (or others like it)
http://nsis.sourceforge.net/Inetc_plug-in It has an option to grab just the headers of an HTTP file request. Then just check if the headers say that the file is there, or whether the file doesn't exist. easypeasy. |
|
|
|
|
|
#3 | |
|
Junior Member
Join Date: Jan 2009
Location: Paris
Posts: 5
|
Quote:
I've try to put "HEAD" in the script but where is the "title" of my file. My file is : test.zip And after launching the programme he wrote that in the "TXT" : What can I do with that ?code: ![]() Here is my code : code: ThiWeb |
|
|
|
|
|
|
#4 |
|
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,449
|
HTTP/1.1 200 = ok, 404 is file not found etc
IntOp $PostCount $PostCount + 1 |
|
|
|
|
|
#5 |
|
Junior Member
Join Date: Jan 2009
Location: Paris
Posts: 5
|
Ahhh ok ok ! Thank you again !
I begin to understand lol ! So if the file exist on the serveur : "TEST.TXT" contain : HTTP/1.1 200 OK If not, there's no file ? No way to have one TXT with 404 in it ? My idee is to check this file and tell : "You are up to date / Or not". If OK => Up to date If 404 => An udate is available Any idee for that ? ThiWeb |
|
|
|
|
|
#6 |
|
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,449
|
no, if its not 200, it could be file not found, server down, or any kind of error
you are better off storing a .ini file on the server, and put the version info in the .ini, just download and use the nsis ini functions to check the version IntOp $PostCount $PostCount + 1 |
|
|
|
|
|
#7 |
|
Junior Member
Join Date: Jan 2009
Location: Paris
Posts: 5
|
Yes... I think you'r right.
INI file on the server is better. I will try this and try also INI Function. Thanks again. I'll surly come back ![]() ThiWeb |
|
|
|
|
|
#8 |
|
Major Dude
Join Date: Jun 2001
Posts: 1,173
|
there's pros and cons to both methods
We use an ini, ourselves, because it allows us to add a summary line of text that we can display in the installer and a URL that we can then hook up to a hyperlink control so the user can browse for more information. However, it does mean that the URL for that ini -must- exist for some time to come - you don't want older installers to suddenly go nuts just because the file can no longer be found - expect, say, 6 months to a year that you should -at least- keep that URL, with valid content, alive. Anybody running an installer that's over a year old should - if the ini file doesn't exist anymore - get a message that their version is possibly horribly outdated, with a link to the main site page. |
|
|
|
|
|
#9 |
|
Major Dude
Join Date: Feb 2004
Location: Moscow, Russia
Posts: 1,222
|
inetc puts to NSIS stack "OK" if file or http headers were downloaded successfully, "File Not Found (404)" if no such file on server. Please note that a lot of other situations may have place on customer comp (like no internet connection at all). Plug-in auto-removes local file on '404' situation. So the best way is to check what you have after "Pop $0". Ini file tracking is another good approach.
|
|
|
|
|
|
#10 |
|
Junior Member
Join Date: Jan 2009
Location: Paris
Posts: 5
|
Hi,
I found something interesting, I try to use an XML to check the version of my installation. Here is the code : I've change the adress with mine, but he say everytime the same thing :code: ![]() And here is my XML : Why he don't me : "Hey ! There's an update available !" ?code: Maybe it's simple to use an INI file, but I'm a beginner with NSIS... Can someone show me how use my script to do what I want ? Or I'm open to try INI way. Thank you so much. ThiWeb |
|
|
|
|
|
#11 |
|
Major Dude
Join Date: Jun 2001
Posts: 1,173
|
I think you'd have to check the documentation for UpdateXml / UpdatePad (wherever those are from - google's proving fruitless on either term in combination with nsis), but if I'd have to perform guesswork...
code: ...I'd say that line means "from the padgen.xml, read the value for the XML path /XML_DIZ_INFO/Program_Info/Program_Version and stick the result in $0". However, your XML does not have that path. Apparently, it's supposed to look more like - say - this: http://www.asp-shareware.org/padinfo/padgen.xml Now, that one has a ton of fields and only a few of them are actually required, but you should be able to tell that the /XML_DIZ_INFO/Program_Info/Program_Version path at least exists in that file. So, again, my guess would be that your XML does not conform to the PAD specification, and thus the PAD scripts fail to work with it. |
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|