main.php
1
2
3
4
5
6
function findGender($name) {
  $apiKey = ''; //Your API Key
  $data = json_decode(file_get_contents('https://genderapi.io/api?key=' . $apiKey . '&name=' . urlencode($name)));
  return $data->gender;
}
echo findGender('angela');
PHP 7.0.8 (cli) (built: Jun 23 2016 23:39:14) ( NTS ) Copyright (c) 1997-2016 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies