Developing the message Bot is effifient to develop in the local side. Finished the code then deploy it.
Question:
- What is ngrok & how to use.
- How to get local and server parameters.
Answer:
What’s ngrok:
Reference ngrok website:
ngrok provide a public address in the local which allow user to connect
How to use ngrok:
first sign up in the website, get the token then download ngrok tool. Execute ngrok authtoken {your token}
, after execute ngrok http 80
, above register the port 80 in ngrok so show information:
this https which register line bot。 or see information from browser log mode. Open browser execute localhost:4040
get below:
How to get local env parameters:
Install package `composerrequire vlucas/phpdotenv
` and use this script:
$dotenv = new Dotenv\Dotenv(__DIR__);
$dotenv->load();
☆★__DIR__ is this php file location。☆★
use file_exists distinguish .env exist or not。If existed, then use getenv parameters:
Reference:
ngrok
phpdotenv