Aide:InetGet.txt

De Wiki AutoIt Français
Aller à : navigation, rechercher

Document original V3.3.6.1 :

###Function###
InetGet

###Description###
Downloads a file from the internet using the HTTP, HTTPS or FTP protocol.

###Syntax###
InetGet ( "URL" [,"filename" [, options [, background]]] )


###Parameters###
@@ParamTable@@
URL
	URL of the file to download.  See remarks below.
filename
	[optional] Local filename to download to.
options
	[optional] 0 = (default) Get the file from local cache if available.
	1 = Forces a reload from the remote site.
	2 = Ignore all SSL errors (with HTTPS connections).
	4 = Use ASCII when transfering files with the FTP protocol (Can not be combined with flag 8).
	8 = Use BINARY when transfering files with the FTP protocol (Can not be combined with flag 4).  This is the default transfer mode if none are provided.
	16 = By-pass forcing the connection online (See remarks).
background
	[optional] 0 = (default) Wait until the download is complete before continuing.
	1 = return immediately and download in the background (see remarks).
@@End@@


###ReturnValue###
@@ReturnTable@@
Success:	The return value changes depending on if the download is in the background:
	Background: A handle is returned.  The handle can be used with InetGetInfo().  The handle must be closed with InetClose().
	Wait: The number of bytes downloaded.
Failure:
	Background: A handle is returned.  To determine if there was an error with the download, use InetGetInfo().  The handle must be closed with InetClose().
	Wait: Sets @error to non-zero and returns 0.
@@End@@


###Remarks###
Internet Explorer 3 or greater must be installed for this function to work.

The URL parameter should be in the form "http://www.somesite.com/path/file.html" - just like an address you would type into your web browser.

To use a username and password when connecting simply prefix the servername with "username:password@", e.g.
"http://myuser:mypassword@www.somesite.com"


<b>Notes about the &quot;background&quot; Parameter</b>

By default the function waits until the download has finished before returning.  If the <b>background</b> parameter is set to 1 the function returns immediately and the download continues in the background.  The function InetGetInfo() can be used to check the status of the download.  It takes the handle returned from InetGet().

Multiple downloads are supported if they are started in background mode.

To abort a download call InetClose() and pass it the handle returned by InetGet().

By default AutoIt forces a connection before starting a download.  For dial-up users this will prompt to go online or dial the modem (depending on how the system is configured).  The options value 16 disables this behavior.  Disabling the behavior can be useful for persistent connects (Broadband, LAN).  However, it is also required to work around certain issues in Windows Vista and Windows 7.

###Related###
InetGetSize, InetRead, InetGetInfo, InetClose, HttpSetProxy, FtpSetProxy, HttpSetUserAgent

###Example###
@@IncludeExample@@


Document traduit V3.3.6.1 :

###Function###
InetGet

###Description###
Télécharge un fichier depuis internet en utilisant le protocole HTTP, HTTPS ou FTP.

###Syntax###
InetGet ( "URL" [,"filename" [, options [, background]]] )


###Parameters###
@@ParamTable@@
URL
	URL du fichier à télécharger.  Voir les remarques ci-dessous.
filename
	[optionnel] Chemin local du fichier à télécharger.
options
	[optionnel] 0 = (défaut) Récupère le fichier depuis le cache local si disponible.
	1 = Force le rechargement depuis le site distant.
	2 = Ignore toutes les erreurs SSL (avec connexions HTTPS).
	4 = Utilise ASCII lors du transfert de fichiers avec le protocole FTP (Ne peut-être combiné avec l'option 8).
	8 = Utilise BINARY lors du transfert de fichiers avec le protocole FTP (Ne peut-être combiné avec l'option 4).  Ceci est le mode de transfert par défaut si aucun n'est fourni.
	16 = Force la connexion en ligne par contournement (Voir remarques).
background
	[optionnel] 0 = (défaut) attend que le téléchargement soit complet avant de continuer.
	1 = retour immédiat et téléchargement en arrière-plan (Voir remarques).
@@End@@


###ReturnValue###
@@ReturnTable@@
Succès:	La valeur de retour change si le téléchargement est en arrière-plan:
	Arrière-plan: Un handle est retourné. Le handle peut-être utilisé avec InetGetInfo(). Le handle doit être fermé avec InetClose().
	Attente: Le nombre d'octets téléchargés.
Échec:
	Arrière-plan: Un handle est retourné. Pour déterminer s'il y a eu une erreur lors du téléchargement, utilisez InetGetInfo().  Le handle doit être fermé avec InetClose().
	Attente: Met @error <> 0 et retourne 0.
@@End@@


###Remarks###
Internet Explorer 3 ou plus récent doit être installé pour faire fonctionner la fonction InetGet().

Le paramètre URL devrait être de la forme "http://www.lesite.fr/chemin/fichier.html" - tout comme une adresse que vous tapez dans votre navigateur web.

Pour utiliser un nom d'utilisateur et un mot de passe lors de la connexion, préfixez simplement le nom de serveur avec "nomutilisateur:motdepasse@", e.g. "http://nomutilisateur:motdepasse@www.lesite.fr"


<b>Notes à propos du paramètre &quot;background&quot;</b>

Par défaut, la fonction attend que le téléchargement soit terminé avant d'envoyer la valeur de retour. Si le paramètre <b>background</b> est mis à 1, le retour de la fonction est immédiat et le téléchargement continue en arrière-plan. La fonction InetGetInfo() peut-être utilisée pour vérifier l'état du téléchargement. Elle utilise le handle retourné par InetGet().

Les téléchargements multiples sont supportés s'ils sont démarrés en mode arrière-plan.

Pour interrompre un téléchargement, appelez InetClose() en utilisant le handle retourné par InetGet().

Par défaut, AutoIt force une connexion avant de démarrer un téléchargement. Les utilisateurs de modems analogique seront invités à passer en ligne ou le numéro sera composé (selon la configuration du système). L'option de valeur 16 désactive ce comportement. Désactiver ce comportement peut-être utile pour les connexions continues (Large bande, LAN). Cependant, il est aussi nécessaire de travailler autour de certains problèmes dans Windows Vista et Windows 7.


###Related###
<a href="InetGetSize.htm">InetGetSize</a>, <a href="InetRead.htm">InetRead</a>, <a href="InetGetInfo.htm">InetGetInfo</a>, <a href="InetClose.htm">InetClose</a>, <a href="HttpSetProxy.htm">HttpSetProxy</a>, <a href="FtpSetProxy.htm">FtpSetProxy</a>, <a href="HttpSetUserAgent.htm">HttpSetUserAgent</a>


###Example###
@@IncludeExample@@


Traducteur : Alex74

Contributeurs (pour les modifications avant le Wiki) : Tlem