как я получаю данные имена от NameAPI php - PullRequest
0 голосов
/ 17 мая 2019

Я использую сильный текст NameAPI для этого

require_once DIR . '/vendor/autoload.php';

use org\nameapi\client\services\ServiceFactory;
use org\nameapi\ontology\input\context\Context;
use org\nameapi\ontology\input\context\Priority;
use org\nameapi\ontology\input\entities\person\NaturalInputPerson;
use org\nameapi\ontology\input\entities\person\name\InputPersonName;

$context = Context::builder() ->place('US') ->priority(Priority::REALTIME())->build(); 
$serviceFactory = new ServiceFactory('apikey', $context);

$emailNameParser = $serviceFactory->emailServices()->emailNameParser();
$result = $emailNameParser->parse($_POST['email']); 
// $d = (string)$result->getResultMatches();

echo $result ;

OutPut: -

Result {
    type=PERSON_NAME,
    matches={givenNames=lalit, confidence=0.87661561787997}
}
...