WebGadget & Proxy

Partagez votre expérience de PureBasic avec les autres utilisateurs.
erix14
Messages : 480
Inscription : sam. 27/mars/2004 16:44
Contact :

WebGadget & Proxy

Message par erix14 »

Bonjour,

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 :mrgreen:
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
Avatar de l’utilisateur
djes
Messages : 4252
Inscription : ven. 11/févr./2005 17:34
Localisation : Arras, France

Re: WebGadget & Proxy

Message par djes »

Cool merci !
Backup
Messages : 14526
Inscription : lun. 26/avr./2004 0:40

Re: WebGadget & Proxy

Message par Backup »

marche bien, merci :)
Avatar de l’utilisateur
Ar-S
Messages : 9477
Inscription : dim. 09/oct./2005 16:51
Contact :

Re: WebGadget & Proxy

Message par Ar-S »

Cool ça, merci erix14, ça fait plaisir de te lire. :P
~~~~Règles du forum ~~~~
⋅.˳˳.⋅ॱ˙˙ॱ⋅.˳Ar-S ˳.⋅ॱ˙˙ॱ⋅.˳˳.⋅
W11x64 PB 6.x
Section HORS SUJET : ICI
LDV MULTIMEDIA : Dépannage informatique & mes Logiciels PB
UPLOAD D'IMAGES : Uploader des images de vos logiciels
Répondre