Last active
November 27, 2023 18:48
-
-
Save unwiredlabs/9543100 to your computer and use it in GitHub Desktop.
Revisions
-
locationapi revised this gist
Jul 8, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,7 +4,7 @@ public static void GetNearest(string key, string mcc, string mnc, string lac, st { try { string url = "http://us1.unwiredlabs.com/v2/process.php"; var httpWebRequest = (HttpWebRequest)WebRequest.Create(url); httpWebRequest.ContentType = "application/json; charset=utf-8"; httpWebRequest.Method = "POST"; -
locationapi revised this gist
Jul 8, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,7 +4,7 @@ public static void GetNearest(string key, string mcc, string mnc, string lac, st { try { string url = "http://us1.uwiredlabs.com/v2/process.php"; var httpWebRequest = (HttpWebRequest)WebRequest.Create(url); httpWebRequest.ContentType = "application/json; charset=utf-8"; httpWebRequest.Method = "POST"; -
locationapi revised this gist
Jul 8, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,7 +4,7 @@ public static void GetNearest(string key, string mcc, string mnc, string lac, st { try { string url = "http://uus1.nwiredlabs.com/v2/process.php"; var httpWebRequest = (HttpWebRequest)WebRequest.Create(url); httpWebRequest.ContentType = "application/json; charset=utf-8"; httpWebRequest.Method = "POST"; -
locationapi revised this gist
Mar 14, 2014 . 1 changed file with 1 addition and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,5 @@ ///Contributed by Stuart Eastland of RightFile.com public static void GetNearest(string key, string mcc, string mnc, string lac, string cid) { try -
locationapi revised this gist
Mar 14, 2014 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,6 @@ ///Contributed by Stuart Eastland of RightFile.com /// /// public static void GetNearest(string key, string mcc, string mnc, string lac, string cid) { try -
locationapi created this gist
Mar 14, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,44 @@ public static void GetNearest(string key, string mcc, string mnc, string lac, string cid) { try { string url = "http://unwiredlabs.com/v2/process.php"; var httpWebRequest = (HttpWebRequest)WebRequest.Create(url); httpWebRequest.ContentType = "application/json; charset=utf-8"; httpWebRequest.Method = "POST"; using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream())) { string json = string.Format("{{ \"token\": \"{0}\", \"radio\": \"gsm\", \"mcc\": {1}, \"mnc\": {2}, \"cells\": [{{ \"lac\": {3}, \"cid\": {4} }}] }}", key, mcc, mnc, lac, cid); streamWriter.Write(json); streamWriter.Flush(); } var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse(); using (var streamReader = new StreamReader(httpResponse.GetResponseStream())) { string json = streamReader.ReadToEnd(); var results = JsonConvert.DeserializeObject<dynamic>(json); var status = results.status.Value; if (status == "ok") { var balance = results.balance.Value; var lat = results.lat.Value; var lon = results.lon.Value; var accuracy = results.accuracy.Value; } else { var message = results.message.Value; } } } catch (Exception ex) { // handle exception } }