Skip to content

Instantly share code, notes, and snippets.

@TyrfingMjolnir
Last active January 29, 2019 20:52
Show Gist options
  • Save TyrfingMjolnir/ec677d62872b4ed9302f5593e4cbfb85 to your computer and use it in GitHub Desktop.
Save TyrfingMjolnir/ec677d62872b4ed9302f5593e4cbfb85 to your computer and use it in GitHub Desktop.
Sources/PerfectTemplate/main.swift

To see the query

( As pr usual no root privileges required for ports above 1024 )

As not everyone has FileMaker Server running, here is a way to check to see what the query does.

$ nc -l -p 8180
POST /fmi/xml/fmresultset.xml HTTP/1.1
Host: 127.0.0.1:8180
Authorization: Basic d2ViOndlYg==
Accept: */*
Content-Type: application/x-www-form-urlencoded;charset=UTF-8
Content-Length: 8

-dbnames

or nc -l -p 8180 | xxd

Prerequisit:

  1. https://asciinema.org/a/224220
  2. https://asciinema.org/a/224221
import PerfectHTTP
import PerfectHTTPServer
import PerfectSMTP
import PerfectFileMaker
import Foundation
let fms = FileMakerServer( host: "127.0.0.1", port: 8180, userName: "username", password: "password" )
fms.databaseNames {
result in
do {
// Get the list of names
let names = try result()
for name in names {
print("Got a database name \(name)")
}
} catch FMPError.serverError(let code, let msg) {
print("Got a server error \(code) \(msg)")
} catch let e {
print("Got an unexpected error \(e)")
}
}
sleep( 2 )
let a = fms
print( a )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment