1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| Function itineraire(dep, fin)
Dim REQ As Object, url As String
Set REQ = CreateObject("microsoft.xmlhttp")
url = "http://maps.google.fr/maps/api/directions/json?origin=" & Replace(dep, " ", "") & ",&destination=" & Replace(fin, " ", "")
With REQ
.Open "POST", url, False
.SetRequestHeader "Accept", "text/html, application/xhtml+xml, */*"
.SetRequestHeader "Accept-Language", "fr-FR"
.SetRequestHeader "User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko"
.SetRequestHeader "Accept-Encoding", "gzip, deflate"
.SetRequestHeader "Host", "maps.google.fr"
.SetRequestHeader "Connection", "Keep - Alive"
.SetRequestHeader "Cache-Control", "no-cache"
.send
itineraire = .responsetext
End With
End Function |
Partager