The local key is to be stored on a file or database (I prefer database).
It's generated when you receive the response from the the server license which you go to check for the license key.
After you receive the results for the license check, you can store the local key to be used when you need to check for the license again, when you tell the checker that you got a local key, it will check the local key instead of going online to check for the license details until the local key is expired.
This is useful when your server is down and your customer need to enter their software, when this happens, the system will use the local key and they will still be able to use the softare until you can resolve the issue with your server.
On the code you'r using, use the debugger and go step by step and you'll see what's going on and when you have the license key to be able to save it.