Answer the question
In order to leave comments, you need to log in
How to create name.json file in php?
Hello! I get a json array in response to an api request, I need to save it, how can I do this?) Stupid question, but I didn’t find anything on the Internet, maybe I’m writing something wrong.
This is how I get data
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://www.booking-manager.com/api/v2/companies');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
$headers = array();
$headers[] = 'Accept: application/json';
$headers[] = 'Authorization: b5cf6d00534c3a0a3ff1a4';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
}
curl_close($ch);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question