Answer the question
In order to leave comments, you need to log in
How to connect to dadata in php?
Hey!
How to connect to api dadata in php?
I copy files from Github to the root of the folder.
In the working file, I specify everything as in the dadata index.php instruction :
<?php
$token = "7c64bad5478644ec171f7a01e6146da958076";
$secret = "83f1a6f5bc781d4d6dd778e1cfe4529a7ca86";
$dadata = new \Dadata\DadataClient($token, $secret);
$result = $dadata->findById("fns_unit", "5257");
echo $result;
Answer the question
In order to leave comments, you need to log in
read what error 500 is
Do what is recommended in such cases
Correct
Composer, of course, you did not use ...
I'm sure that the backwardness of the developers has nothing to do with it, but someone else is lagging behind the progress.
Thanks to everyone who answered and to the developers, you can install Composer and other fashionable things yourself.
Who's Doing Business -
Retrieving data using PHP, a ready-made example
<?php
$data = [
'query' => 'москва'
];
$options = [
'http' => [
'method' => 'POST',
'header' => [
'Content-Type: application/json',
'Accept: application/json',
'Authorization: Token 7c64bad5478644ec171f7a01e6146da958076'
],
'content' => json_encode($data)
]
];
$builder = stream_context_create($options);
$document = file_get_contents('https://suggestions.dadata.ru/suggestions/api/4_1/rs/suggest/fns_unit', false, $builder);
$output = json_decode($document);
var_dump($output);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question