Swift 4.2 using codable with PHP

Help guys, I have link API: http://localhost/twiter/register.php?username=xxxxxxx&password=xxxxxxx&email=xxxxxx@gmail.com&fullname=xxxxxxx

And in Swift to access:
struct Registro: Codable {
var username: String
var email: String
var password: String?
var fullname: String


//Only for test
let jsonUrlString = "http://localhost/twiter/register.php?username=fabio3&password=teste123&email=fabio1@gmail.com&fullname=Fabio%20Uno"
guard let url = URL(string: jsonUrlString) else {

    URLSession.shared.dataTask(with: url) { (data, response, err) in
     guard let data = data else {return}
        do {
            let registro_parse = try JSONDecoder().decode([Registro].self, from: data)
        } catch {
            print("Não gravou!")
    } .resume()

Error "Não Gravou"

Hey @faustus-gomes

These are independent systems. Swift doesn't know anything about PHP, and vice versa.

If you're using HTTP requests to connect the two, then you just need to make sure that the HTTP request you send from Swift (or anywhere else) matches the format expected by the PHP server (or any other kind of server)

As a side note, you should never encode passwords into URL query parameters like that: they're stored in plaintext, sit around in people's mail archives, browser history, etc. And unless you're using HTTPS (which you should be, once you get the other parts of the system working), the query parameters are also visible in plain text to anyone snooping on the network.

Instead, you should use a one-time token, which lets the user register (or change their password, or whatever) that is valid once and then never again. This way if it gets intercepted, or read out of browser history, etc., it can't be used to take over the account.

Thanks Alexander.