необходимо передать действие add, секретный ключ и параметры добавляемого пользователя
function so_payment_complete($order_id)
{
$order = wc_get_order($order_id);
$user = $order->get_user();
$data = $order->get_data();
$name = $data['billing']['first_name'];
$phone = $data['billing']['phone'];
$email = $data['billing']['email'];
$params = [
'name' => $name,
'phone' => $phone,
'email' => $email,
'group_name' => [
'group'
]
];
$key = "uAjAactnIFjpyQ71czuzWrKgfXyLdSGqJ9DZYvL0lFsxcdiDv3YVZlHQZ1ZyRpJKyFrOEv9z62VgBBHgCg0Rwo63PWIQuTM5RSxdxjV5bB1Ukptz3h0i9jVA2Cso1L9O";
$postdata = [
'action' => 'add',
'key' => $key,
'params' => $params,
];
$curl = curl_init('https://nolimitst.getcourse.ru/pl/api/users/');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Linux; Android 7.0; SM-G930V Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.125 Mobile Safari/537.36');
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $postdata);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_exec($curl);
}
<!DOCTYPE html>
<html lang="en">
<head>
<title>My API</title>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="noindex,nofollow" />
<link href="https://fonts.googleapis.com/css?family=Montserrat:300,400,700|Roboto:300,400,700" rel="stylesheet">
<style>
body {
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<script>
<redoc spec-url="my-api.json"></redoc>
</script>
<script src="https://cdn.jsdelivr.net/npm/redoc@next/bundles/redoc.standalone.js"> </script>
</body>
</html>
$_SERVER['HTTP_REFERER']
с помощью parse_url()
и проверяете, что он принадлежит гуглу. Либо забиваете список всех доменов, либо регуляркой. $json = '[{"action_type": null, "button_num": null, "call_id": 20110440096793, "created": "2020-11-04T14:19:03.870Z", "dial_status": 1, "dial_status_display": "\u041e\u0448\u0438\u0431\u043a\u0430 \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u0430\u0431\u043e\u043d\u0435\u043d\u0442\u0430", "phone": "+79374080780", "recorded_audio": "https://zvonok.com/directcdr/6b98300086400a0746554...", "status": "attempts_exc", "status_display": "\u041f\u043e\u043f\u044b\u0442\u043a\u0438 \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u0438\u0441\u044c", "updated": "2020-11-04T14:19:26.955Z", "completed": "2020-11-04T14:19:14.006Z", "user_choice": null, "user_choice_display": null, "duration": 0.0, "audioclip_id": null, "ivr_data": null, "cost": "0", "currency": "RUB"}]';
$records = json_decode($json, true);
$audio = $records[0]['recorded_audio']
$a = [
[
'name' => 'Название 1',
'price' => 140,
],
[
'name' => 'Название 2',
'price' => 140,
]
];
$b = [2, 10];
$result = array_map(fn($item, $qty) => $item + ['quantity' => $qty], $a, $b);
$result = array_map(function ($item, $qty) {
return $item + ['quantity' => $qty];
}, $a, $b);