That's normal – wget just uses the last path component as the filename.
You can use --trust-server-names
to make it use whatever filename the server suggests (like web browsers do), or -O php-7.1.3.tar.gz
to specify it yourself.
However, you have the wrong URL here. Both http://php.net/get/php-7.1.3.tar.gz
and http://php.net/get/php-7.1.3.tar.gz/from/a/mirror
merely lead to HTML webpages. You should visit that page in a web browser and pick a specific download URL. For example:
wget --trust-server-names http://dk2.php.net/get/php-7.1.3.tar.gz/from/this/mirror