A simple URL shortener using a flat file written in PHP.
$ cd ~/shrtnr
$ php -S localhost:4555
The terminal will show:
PHP 7.0 Development Server started at Thu Jul 21 10:43:28 2017
Listening on localhost:4555
Document root is /home/me/shrtnr
Press Ctrl-C to quit
- Go to http://localhost:4555 on the browser
- Enter a long Url
- Get the result
- Use Postman and enter http://localhost:4555/index.php?create=true as the API endpoint.
- Select
raw
for the body and form an JSON array like this:{"link": "http://www.apple.com"}
- Get the result