Voici un code pour que votre WebGadget puisse passer par un Proxy. C'est valable uniquement pour la session Internet en cours.
Attention, choisir un Proxy "Anonyme" pour n'avoir aucune trace, car en PHP on peut détecter le Proxy et retrouver votre vrai IP.
Dans l'exemple ci-dessous j'utilise un Proxy gratuit d'Inde hautement anonyme. Le site mon-ip.com ne détecte pas le Proxy
Vous pouvez trouver des Proxy gratuits ici => http://www.freeproxylists.net
Code : Tout sélectionner
EnableExplicit
Structure INTERNET_PROXY_INFO
dwAccessType.l
*lpszProxy.l
*lpszProxyBypass.l
EndStructure
#INTERNET_OPTION_PROXY = 38
#INTERNET_OPEN_TYPE_PROXY = 3
#INTERNET_OPEN_TYPE_DIRECT = 1
Procedure SetProxy(Proxy.s, Port.l, flags.l=#INTERNET_OPEN_TYPE_PROXY)
Protected ProxyServer.s = Proxy + ":" + Str(Port)
Protected PIInfo.INTERNET_PROXY_INFO
PIInfo\dwAccessType = flags
PIInfo\lpszProxy = @ProxyServer
PIInfo\lpszProxyBypass = @""
If UrlMkSetSessionOption_(#INTERNET_OPTION_PROXY, @PIInfo, SizeOf(INTERNET_PROXY_INFO), 0) = #S_OK
ProcedureReturn #True
Else
ProcedureReturn #False
EndIf
EndProcedure
If OpenWindow(0, 0, 0, 800, 600, "WebGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
; www.freeproxylists.net => Liste de proxy gratuit
If Not SetProxy("14.139.225.83", 3128) ;=> un proxy en Inde (Haut Anonyme)
Debug "La commande a échoué"
EndIf
WebGadget(0, 10, 10, 780, 580, "www.mon-ip.com")
Repeat
Global Event.l = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
EndIf