FORUMS PROFESSIONNELS
WINDEV
,
WEBDEV
et
WINDEV Mobile
Accueil
|
Messages récents
|
Connexion
|
Déconnexion
|
Français
Accueil
→
WINDEV 25
→
WX - HTTPCreateForm
WX - HTTPCreateForm
Débuté par BOLLER, 22 juil. 2017 03:06 - Aucune réponse
Connectez-vous…
BOLLER
#1
Membre enregistré
3 655 messages
Popularité : +175 (223 votes)
Posté le 22 juillet 2017 - 03:06
Procedure
WS_
RotasGoogleMapsFunc
(
enderecoOrigem
is string
) :
string
IF
IniOSMode
(
)
THEN
Multitask
(
-
3
)
ELSE
IF
InAndroidMode
(
)
THEN
Multitask
(
3
)
END
END
Resultado
is string
IF
enderecoOrigem
=
""
RESULT
(
Null
)
END
enderecoOrigem
=
Replace
(
enderecoOrigem
,
CR
,
"+"
)
//Limpa variaveis
gs
FuncionarioEnderecoLongo
=
""
gs
DestinoEnderecoLongo
=
""
gs
TempoDestino
=
""
gs
DistanciaDestino
=
""
gs
HtmlInstructions
=
""
gs
PoligonalGoogle
=
""
gr
DistanciaCarro
=
0
gr
TempoCarro
=
0
gr
Nortelatitude
=
0
gr
NorteLongitute
=
0
gr
Sullatitude
=
0
gr
SulLongitute
=
0
HTTPTimeOut
(
5000
)
HTTPCreateForm
(
"GoogleMaps"
)
HTTPAddParameter
(
"GoogleMaps"
,
"origin"
,
enderecoOrigem
)
HTTPAddParameter
(
"GoogleMaps"
,
"destination"
,
enderecoOrigem
)
HTTPAddParameter
(
"GoogleMaps"
,
"language"
,
"pt-BR"
)
HTTPAddParameter
(
"GoogleMaps"
,
"region"
,
"br"
)
HTTPAddParameter
(
"GoogleMaps"
,
"units"
,
"metric"
)
HTTPAddParameter
(
"GoogleMaps"
,
"key"
,
"AIzaSyDbSVKYPwB1a-_vPbDzAr6LgAfIj4iW2hc"
)
//CHAVE GOOGLE
c
MyRequest
is
a
httpRequest
c
MyRequest
..
URL
=
"https://maps.googleapis.com/maps/api/directions/xml"
c
MyRequest
..
Method
=
httpGet
c
MyResponse
is
a
httpResponse
=
HTTPSendForm
(
"GoogleMaps"
,
c
MyRequest
)
IF
c
MyResponse
..
StatusCode
<
>
200
THEN
// Se não funcionou
RESULT
(
Null
)
END
xmlGoogle
is
a
xmlDocument
=
XMLOpen
(
c
MyResponse
..
Content
,
fromString
)
IF
NOT xmlGoogle.DirectionsResponse.status
..
Text
~
=
"OK"
THEN
RESULT
(
Null
)
END
//Lendo nos unicos
Debug
(
"WS_RotasGoogleMaps"
,
c
MyResponse
..
Content
)
gs
FuncionarioEnderecoLongo
=
xmlGoogle.DirectionsResponse.route.leg.start_address
gr
LatitudeFuncionarioThread
=
xmlGoogle.DirectionsResponse.route.leg.start_location.lat
gr
LongitudeFucionarioThread
=
xmlGoogle.DirectionsResponse.route.leg.start_location.lng
//Loop nos nós do xml
C
ontador
is int
=
1
FOR
E
ACH legNode OF xmlGoogle.DirectionsResponse.route.leg
IF
legNode
..
Name
=
"step"
THEN
HTML
is string
=
legNode.html_instructions
Distancia
is int
=
legNode.distance.value
Resultado
+
=
C
ontador
+
". "
+
HTML
+
" ["
+
Distancia
+
"]"
+
CR
C
ontador
+
+
END
END
// </Xml>RESULT(Resultado)
--
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