PoshCode Archive  Artifact [a1a82fd039]

Artifact a1a82fd039dc7a321370bec322cceaeed1c098fb4b4f89de381480f36646974c:

  • File LookUp-WirelessLocation.ps1 — part of check-in [d2a1b6c95c] at 2018-06-10 14:15:32 on branch trunk — This simple function translates a wireless AP’s BBID (mac) through the SkyhookWireless API’s to return location information… (user: CrazyDave size: 1188)

# encoding: ascii
# api: powershell
# title: LookUp-WirelessLocation
# description: This simple function translates a wireless AP’s BBID (mac) through the SkyhookWireless API’s to return location information…
# version: 2.6
# type: function
# author: CrazyDave
# license: CC0
# function: LookUp-Location
# x-poshcode-id: 643
# x-archived: 2016-05-23T02:55:57
# x-published: 2009-10-19T05:08:00
#
# Currently the output is just the raw XML response from the server…
#
function LookUp-Location {
param([String] $mac)
$mac = $mac.Replace(":","").Replace("-","")

$wClient = New-Object System.Net.WebClient
$body = "<?xml version='1.0'?><LocationRQ xmlns='http://skyhookwireless.com/wps/2005' version='2.6' street-address-lookup='full'><authentication version='2.0'><simple><username>beta</username><realm>js.loki.com</realm></simple></authentication><access-point><mac>#{mac}</mac><signal-strength>-50</signal-strength></access-point></LocationRQ>"
$url = "https://api.skyhookwireless.com/wps2/location"
$wClient.Headers.Add("Content-Type:text/xml")
$body = $body.Replace("#{mac}", $mac)

$response = $wClient.UploadString($url, $body)
return $response
}