FORUMS PROFESSIONNELS
WINDEV
,
WEBDEV
et
WINDEV Mobile
Accueil
|
Messages récents
|
Connexion
|
Déconnexion
|
Français
Accueil
→
WINDEV 25
→
Wx - Verificando se tem internet
Wx - Verificando se tem internet
Débuté par adrianoboller, 31 oct. 2015 16:53 - 3 réponses
Connectez-vous…
adrianoboller
#1
Membre enregistré
3 655 messages
Popularité : +175 (223 votes)
Posté le 31 octobre 2015 - 16:53
Procedure
ConexaoInternet
(
)
GloConexaoInternet
=
0
ok is
boolean
=
False
PosicaoOK is
int
=
0
Httpurl
,
HttpRetorno is
string
Httpurl
=
"http://www.google.com.br"
HTTPTimeOut
(
GloHTTPTimeOut
)
IF
HTTPRequest
(
Httpurl
) =
True
AND
Httpurl
<
>
""
THEN
HttpRetorno
=
HTTPGetResult
(
httpHeader
)
PosicaoOK
=
PositionOccurrence
(
HttpRetorno
,
"Connection"
,
firstRank
,
IgnoreCase
)
IF
PosicaoOK
=
0
THEN
PosicaoOK
=
PositionOccurrence
(
Upper
(
HttpRetorno
)
,
"200"
,
firstRank
,
IgnoreCase
)
IF
PosicaoOK
=
0
THEN
PosicaoOK
=
PositionOccurrence
(
Upper
(
HttpRetorno
)
,
"OK"
,
firstRank
,
IgnoreCase
)
END
END
IF
Httpurl
<
>
""
AND
PosicaoOK
>
0
AND
HttpRetorno
<
>
""
THEN
GloConexaoInternet
=
1
ok
=
True
ELSE
GloConexaoInternet
=
0
ok
=
False
END
ELSE
GloConexaoInternet
=
0
ok
=
False
END
RESULT
(
ok
)
//Se retorno for true tem se nao nao tem internet
--
Adriano Jose Boller
______________________________________________
Consultor e Representante Oficial da
PcSoft no Brasil
+55 (41) 9949 1800
adrianoboller@gmail.com
skype: adrianoboller
______________________________________________
Signaler
0
0
adrianoboller
#2
Membre enregistré
3 655 messages
Popularité : +175 (223 votes)
Posté le 31 octobre 2015 - 16:57
Prezados,
Outra forma de verificar se tem internet é usando o comando nativo:
ResConnection
=
InternetConnected
(
)
IF
ResConnection
=
True
THEN
Info
(
"An Internet connection is enabled"
)
ELSE
Info
(
"No Internet connection is enabled"
)
END
Link complementar:
http://help.windev.com/en-US/…
--
Adriano Jose Boller
______________________________________________
Consultor e Representante Oficial da
PcSoft no Brasil
+55 (41) 9949 1800
adrianoboller@gmail.com
skype: adrianoboller
______________________________________________
Signaler
1
0
Danilo Valim
#3
Membre enregistré
13 messages
Popularité : +9 (9 votes)
Posté le 09 novembre 2015 - 17:45
Show Funcionou perfeitamente!
Signaler
0
0
BOLLER
#4
Membre enregistré
3 655 messages
Popularité : +175 (223 votes)
Posté le 18 janvier 2018 - 14:01
// Résumé : <indiquez ici ce que fait la procédure>
// Syntaxe :
//[ <Résultat> = ] VerificaWebservice (<WebserviceURL>, <nTimeOut>)
//
// Paramètres :
//
WebserviceURL : <indiquez ici le rôle de WebserviceURL>
//
nTimeOut : <indiquez ici le rôle de nTimeOut>
// Valeur de retour :
//
booléen : //
Aucune
//
// Exemple :
// Indiquez ici un exemple d'utilisation.
//
Procedure
VerificaWebservice
(
WebserviceURL
,
n
TimeOut
)
ok
is boolean
=
False
PosicaoOK
is int
=
0
HttpRetorno
is string
IF
WebserviceURL
=
""
WebserviceURL
=
"http://www.google.com.br"
END
IF
n
TimeOut
=
0
OR
n
TimeOut
=
""
THEN
n
TimeOut
=
3000
//3s
END
HTTPTimeOut
(
n
TimeOut
)
IF httpRequest
(
WebserviceURL
) =
True
THEN
HttpRetorno
=
HTTPGetResult
(
httpHeader
)
PosicaoOK
=
PositionOccurrence
(
HttpRetorno
,
"Connection"
,
firstRank
,
IgnoreCase
)
IF
PosicaoOK
=
0
THEN
PosicaoOK
=
PositionOccurrence
(
Upper
(
HttpRetorno
)
,
"200"
,
firstRank
,
IgnoreCase
)
IF
PosicaoOK
=
0
THEN
PosicaoOK
=
PositionOccurrence
(
Upper
(
HttpRetorno
)
,
"OK"
,
firstRank
,
IgnoreCase
)
END
END
IF
WebserviceURL
<
>
""
AND
PosicaoOK
>
0
AND
HttpRetorno
<
>
""
THEN
ok
=
True
ELSE
ok
=
False
END
ELSE
ok
=
False
END
RESULT
(
ok
)
--
Adriano José Boller
______________________________________________
Consultor e Representante Oficial da
PcSoft no Brasil
+55 (41) 99949 1800
adrianoboller@gmail.com
skype: adrianoboller
http://wxinformatica.com.br/
Signaler
0
0
→ Revenir à WINDEV 25
WINDEV 25
Français
English
Español
Portuguesa
Fermer cette fenêtre
Type de recherche
Uniquement les sujets
Tous les messages
Période de recherche
Date indifférente
Moins d'une heure
Moins de 24 heures
Moins d'une semaine
Moins d'un mois
Moins d'un an
Annuler
Aperçu de votre message
Ajouter une image
Importer une image depuis une URL
Envoyer une image depuis un fichier de votre disque
Déposez ici un fichier ou cliquez sur "Parcourir..."
ou
Annuler
0%
WLangage
SQL
XML, HTML
JAVA, Javascript
Texte