title: How to store push notification token into external database - iOS 10, Swift 3
body: <p>i had implement FCM and i would like to send push notification from my own app server(written in PHP). Therefore, i would need to store the device token for fcm in my Phpmyadmin database. Is there a way to store the token into my database from iOS swift? would be appreciated if someone would give me some tips regarding this issue, thanks!</p>
  
  <p><strong>AppDelegate.swift</strong></p>
  
  <pre><code>func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
      var token = ""
  
      for i in 0..&lt;deviceToken.count {
          token += String(format: "%02.2hhx", arguments: [deviceToken[i]])
      }
  
      print("Registration succeeded!")
      print("Token: ", token)
  
  }
  </code></pre>
  
  <p><strong>Database table structure:</strong></p>
  
  <p><a href="https://i.stack.imgur.com/bAJWP.png" rel="nofollow"><img src="https://i.stack.imgur.com/bAJWP.png" alt="enter image description here"></a></p>