PROFESSIONAL NEWSGROUPS
WINDEV
,
WEBDEV
and
WINDEV Mobile
Home
|
Recent messages
|
Connect
|
Sign out
|
English
Home
→
WINDEV 25
→
WX - HTTPCreateForm
WX - HTTPCreateForm
Started by BOLLER, Jul., 22 2017 3:06 AM - No answer
Connect yourself…
BOLLER
#1
Registered member
3,655 messages
Popularité : +175 (223 votes)
Posted on July, 22 2017 - 3:06 AM
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/
Report
0
0
→ Go back to WINDEV 25
WINDEV 25
Français
English
Español
Portuguesa
Close this window
Search type
Only topics
All the messages
Search period
Any time
Past hour
Past 24 hours
Past week
Past month
Past year
Cancel
Preview of your message
Adding an image
Import an image from a URL
Send an image from a file of your disk
Drop a file or click "Browse..."
or
Cancel
0%
WLanguage
SQL
XML, HTML
JAVA, Javascript
Text