FOROS PROFESIONALES
WINDEV
,
WEBDEV
y
WINDEV Mobile
Inicio
|
Mensajes recientes
|
Conéctese...
|
Desconectar
|
Español
Inicio
→
WINDEV 25
→
WX - HTTPCreateForm
WX - HTTPCreateForm
Iniciado por BOLLER, 22,jul. 2017 03:06 - No hay respuesta
Conéctese…
BOLLER
#1
Miembro registrado
3.657 mensajes
Popularité : +175 (223 votes)
Publicado el 22,julio 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/
Informar
0
0
→ Volver a WINDEV 25
WINDEV 25
Français
English
Español
Portuguesa
Fermer cette fenêtre
Búsqueda Tipo
Sólo temas
Todos los mensajes
Periodo Buscar
Cualquier fecha
Última hora
Última 24 horas
Última semana
Último mes
Último año
Cancelar
Vista previa del mensaje
Añadiendo una imagen
Importar una imagen desde una URL
Enviar una imagen desde un archivo de su disco
Arrastrar un archivo o click en "Examinar..."
o
Cancelar
0%
WLanguage
SQL
XML, HTML
JAVA, Javascript
Texto